pub trait Client:
Send
+ Sync
+ Unpin
+ 'static {
type Url: Display + Send + Sync + Unpin;
type Headers: ResponseHeaders;
type Response: ClientResponse<Headers = Self::Headers>;
type Error: Error + Send + Sync;
// Required methods
fn create() -> Self;
fn get(
&self,
url: &Self::Url,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send;
fn get_range(
&self,
url: &Self::Url,
start: u64,
end: Option<u64>,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send;
}
Available on crate feature
http
only.Expand description
Wrapper trait for an HTTP client that exposes only functionality necessary for retrieving the
stream content. If the reqwest
feature is enabled, this trait is implemented for
reqwest::Client.
This can be implemented for a custom HTTP client if desired.
Required Associated Types§
Sourcetype Headers: ResponseHeaders
type Headers: ResponseHeaders
The type that contains the HTTP response headers.
Sourcetype Response: ClientResponse<Headers = Self::Headers>
type Response: ClientResponse<Headers = Self::Headers>
The HTTP response object.
Required Methods§
Sourcefn get(
&self,
url: &Self::Url,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send
fn get( &self, url: &Self::Url, ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send
Sends an HTTP GET request to the URL.
Sourcefn get_range(
&self,
url: &Self::Url,
start: u64,
end: Option<u64>,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send
fn get_range( &self, url: &Self::Url, start: u64, end: Option<u64>, ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send
Sends an HTTP GET request to the URL utilizing the Range
header to request a specific part
of the stream.
The end value should be inclusive, per the HTTP spec.
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.
Implementations on Foreign Types§
Source§impl Client for ClientWithMiddleware
Available on crate feature reqwest-middleware
only.
impl Client for ClientWithMiddleware
Available on crate feature
reqwest-middleware
only.type Url = Url
type Response = Response
type Error = Error
type Headers = HeaderMap
fn create() -> Self
async fn get(&self, url: &Self::Url) -> Result<Self::Response, Self::Error>
async fn get_range( &self, url: &Self::Url, start: u64, end: Option<u64>, ) -> Result<Self::Response, Self::Error>
Source§impl Client for Client
Available on crate feature reqwest
only.
impl Client for Client
Available on crate feature
reqwest
only.