pub trait ClientReq<CustErr>: Sized {
    type FormData;

    // Required methods
    fn try_new_get(
        path: &str,
        content_type: &str,
        accepts: &str,
        query: &str,
    ) -> Result<Self, ServerFnError<CustErr>>;
    fn try_new_post(
        path: &str,
        content_type: &str,
        accepts: &str,
        body: String,
    ) -> Result<Self, ServerFnError<CustErr>>;
    fn try_new_post_bytes(
        path: &str,
        content_type: &str,
        accepts: &str,
        body: Bytes,
    ) -> Result<Self, ServerFnError<CustErr>>;
    fn try_new_post_form_data(
        path: &str,
        accepts: &str,
        content_type: &str,
        body: Self::FormData,
    ) -> Result<Self, ServerFnError<CustErr>>;
    fn try_new_multipart(
        path: &str,
        accepts: &str,
        body: Self::FormData,
    ) -> Result<Self, ServerFnError<CustErr>>;
    fn try_new_streaming(
        path: &str,
        accepts: &str,
        content_type: &str,
        body: impl Stream<Item = Bytes> + Send + 'static,
    ) -> Result<Self, ServerFnError<CustErr>>;
}
Expand description

Represents a request as made by the client.

Required Associated Types§

Source

type FormData

The type used for URL-encoded form data in this client.

Required Methods§

Source

fn try_new_get( path: &str, content_type: &str, accepts: &str, query: &str, ) -> Result<Self, ServerFnError<CustErr>>

Attempts to construct a new GET request.

Source

fn try_new_post( path: &str, content_type: &str, accepts: &str, body: String, ) -> Result<Self, ServerFnError<CustErr>>

Attempts to construct a new POST request with a text body.

Source

fn try_new_post_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, ) -> Result<Self, ServerFnError<CustErr>>

Attempts to construct a new POST request with a binary body.

Source

fn try_new_post_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, ) -> Result<Self, ServerFnError<CustErr>>

Attempts to construct a new POST request with form data as the body.

Source

fn try_new_multipart( path: &str, accepts: &str, body: Self::FormData, ) -> Result<Self, ServerFnError<CustErr>>

Attempts to construct a new POST request with a multipart body.

Source

fn try_new_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<Self, ServerFnError<CustErr>>

Attempts to construct a new POST request with a streaming body.

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.

Implementors§