pub trait HttpClientExt<State>:
HttpClientExtSealed<State>
+ Sized
+ Send
+ Sync
+ 'static {
type ExecuteResponse;
type ExecuteError;
// Required methods
fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn execute(
&self,
ctx: Context<State>,
request: Request,
) -> impl Future<Output = Result<Self::ExecuteResponse, Self::ExecuteError>>;
}
Expand description
Extends an Http Client with high level features, to facilitate the creation and sending of http requests, in a more ergonomic way.
Required Associated Types§
Sourcetype ExecuteResponse
type ExecuteResponse
The response type returned by the execute
method.
Sourcetype ExecuteError
type ExecuteError
The error type returned by the execute
method.
Required Methods§
Sourcefn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn get( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Sourcefn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn post( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Sourcefn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn put( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Sourcefn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Sourcefn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Sourcefn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn head( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Convenience method to make a HEAD
request to a URL.
§Errors
This method fails whenever the supplied Url
cannot be parsed.
Sourcefn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Sourcefn execute(
&self,
ctx: Context<State>,
request: Request,
) -> impl Future<Output = Result<Self::ExecuteResponse, Self::ExecuteError>>
fn execute( &self, ctx: Context<State>, request: Request, ) -> impl Future<Output = Result<Self::ExecuteResponse, Self::ExecuteError>>
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.