Trait RestRequest

Source
pub trait RestRequest {
    type Response: DeserializeOwned;
    type QueryParams: Serialize;
    type Body: Serialize;

    // Required methods
    fn path(&self) -> Cow<'static, str>;
    fn method() -> Method;

    // Provided methods
    fn query_params(&self) -> Option<&Self::QueryParams> { ... }
    fn body(&self) -> Option<&Self::Body> { ... }
    fn timeout() -> Duration { ... }
}
Expand description

Http REST request that can be executed by a RestClient.

Required Associated Types§

Source

type Response: DeserializeOwned

Expected response type if this request was successful.

Source

type QueryParams: Serialize

Serialisable query parameters type - use unit struct () if not required for this request.

Source

type Body: Serialize

Serialisable Body type - use unit struct () if not required for this request.

Required Methods§

Source

fn path(&self) -> Cow<'static, str>

Additional Url path to the resource.

Source

fn method() -> Method

Http reqwest::Method of this request.

Provided Methods§

Source

fn query_params(&self) -> Option<&Self::QueryParams>

Optional query parameters for this request.

Source

fn body(&self) -> Option<&Self::Body>

Optional Body for this request.

Source

fn timeout() -> Duration

Http request timeout Duration.

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§