Trait ClientReq
pub trait ClientReq<E>: Sized {
type FormData;
Show 23 methods
// Required methods
fn try_new_req_query(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
method: Method,
) -> Result<Self, E>;
fn try_new_req_text(
path: &str,
content_type: &str,
accepts: &str,
body: String,
method: Method,
) -> Result<Self, E>;
fn try_new_req_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
method: Method,
) -> Result<Self, E>;
fn try_new_req_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
method: Method,
) -> Result<Self, E>;
fn try_new_req_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
method: Method,
) -> Result<Self, E>;
fn try_new_req_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
method: Method,
) -> Result<Self, E>;
// Provided methods
fn try_new_get(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
) -> Result<Self, E> { ... }
fn try_new_delete(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
) -> Result<Self, E> { ... }
fn try_new_post(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E> { ... }
fn try_new_patch(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E> { ... }
fn try_new_put(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E> { ... }
fn try_new_post_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E> { ... }
fn try_new_patch_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E> { ... }
fn try_new_put_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E> { ... }
fn try_new_post_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E> { ... }
fn try_new_patch_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E> { ... }
fn try_new_put_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E> { ... }
fn try_new_post_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E> { ... }
fn try_new_patch_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E> { ... }
fn try_new_put_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E> { ... }
fn try_new_post_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E> { ... }
fn try_new_patch_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E> { ... }
fn try_new_put_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E> { ... }
}
Expand description
Represents a request as made by the client.
Required Associated Types§
type FormData
type FormData
The type used for URL-encoded form data in this client.
Required Methods§
fn try_new_req_query(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
method: Method,
) -> Result<Self, E>
fn try_new_req_query( path: &str, content_type: &str, accepts: &str, query: &str, method: Method, ) -> Result<Self, E>
Attempts to construct a new request with query parameters.
fn try_new_req_text(
path: &str,
content_type: &str,
accepts: &str,
body: String,
method: Method,
) -> Result<Self, E>
fn try_new_req_text( path: &str, content_type: &str, accepts: &str, body: String, method: Method, ) -> Result<Self, E>
Attempts to construct a new request with a text body.
fn try_new_req_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
method: Method,
) -> Result<Self, E>
fn try_new_req_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, method: Method, ) -> Result<Self, E>
Attempts to construct a new request with a binary body.
fn try_new_req_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
method: Method,
) -> Result<Self, E>
fn try_new_req_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, method: Method, ) -> Result<Self, E>
Attempts to construct a new request with form data as the body.
Provided Methods§
fn try_new_get(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
) -> Result<Self, E>
fn try_new_get( path: &str, content_type: &str, accepts: &str, query: &str, ) -> Result<Self, E>
Attempts to construct a new GET
request.
fn try_new_delete(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
) -> Result<Self, E>
fn try_new_delete( path: &str, content_type: &str, accepts: &str, query: &str, ) -> Result<Self, E>
Attempts to construct a new DELETE
request.
Note: Browser support for DELETE
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_post(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E>
fn try_new_post( path: &str, content_type: &str, accepts: &str, body: String, ) -> Result<Self, E>
Attempts to construct a new POST
request with a text body.
fn try_new_patch(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E>
fn try_new_patch( path: &str, content_type: &str, accepts: &str, body: String, ) -> Result<Self, E>
Attempts to construct a new PATCH
request with a text body.
Note: Browser support for PATCH
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_put(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E>
fn try_new_put( path: &str, content_type: &str, accepts: &str, body: String, ) -> Result<Self, E>
Attempts to construct a new PUT
request with a text body.
Note: Browser support for PUT
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_post_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E>
fn try_new_post_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, ) -> Result<Self, E>
Attempts to construct a new POST
request with a binary body.
fn try_new_patch_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E>
fn try_new_patch_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, ) -> Result<Self, E>
Attempts to construct a new PATCH
request with a binary body.
Note: Browser support for PATCH
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_put_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E>
fn try_new_put_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, ) -> Result<Self, E>
Attempts to construct a new PUT
request with a binary body.
Note: Browser support for PUT
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_post_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_post_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new POST
request with form data as the body.
fn try_new_patch_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_patch_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new PATCH
request with form data as the body.
Note: Browser support for PATCH
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_put_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_put_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new PUT
request with form data as the body.
Note: Browser support for PUT
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_post_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_post_multipart( path: &str, accepts: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new POST
request with a multipart body.
fn try_new_patch_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_patch_multipart( path: &str, accepts: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new PATCH
request with a multipart body.
Note: Browser support for PATCH
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_put_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_put_multipart( path: &str, accepts: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new PUT
request with a multipart body.
Note: Browser support for PUT
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_post_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E>
fn try_new_post_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<Self, E>
Attempts to construct a new POST
request with a streaming body.
fn try_new_patch_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E>
fn try_new_patch_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<Self, E>
Attempts to construct a new PATCH
request with a streaming body.
Note: Browser support for PATCH
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
fn try_new_put_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E>
fn try_new_put_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<Self, E>
Attempts to construct a new PUT
request with a streaming body.
Note: Browser support for PUT
requests without JS/WASM may be poor.
Consider using a POST
request if functionality without JS/WASM is required.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.