pub struct Client(/* private fields */);
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(
user_agent: impl AsRef<str>,
min_tls: Option<TLSVersion>,
per_millis: NonZeroU16,
num_request: NonZeroU64,
certificates: impl IntoIterator<Item = Certificate>,
) -> Result<Self, Error>
pub fn new( user_agent: impl AsRef<str>, min_tls: Option<TLSVersion>, per_millis: NonZeroU16, num_request: NonZeroU64, certificates: impl IntoIterator<Item = Certificate>, ) -> Result<Self, Error>
per_millis
- The duration (in millisecond) for which at mostnum_request
can be sent, itcould be increased if rate-limit happens.num_request
- maximum number of requests to be processed for eachper
duration.
The Client created would use at least tls 1.2
Sourcepub async fn remote_gettable(&self, url: Url) -> Result<bool, Error>
pub async fn remote_gettable(&self, url: Url) -> Result<bool, Error>
Check if remote exists using Method::GET
.
Sourcepub async fn get_redirected_final_url(&self, url: Url) -> Result<Url, Error>
pub async fn get_redirected_final_url(&self, url: Url) -> Result<Url, Error>
Attempt to get final redirected url using Method::HEAD
or fallback
to Method::GET
.
Sourcepub async fn get_stream(
&self,
url: Url,
) -> Result<impl Stream<Item = Result<Bytes, Error>>, Error>
pub async fn get_stream( &self, url: Url, ) -> Result<impl Stream<Item = Result<Bytes, Error>>, Error>
Create GET
request to url
and return a stream of the response data.
On status code other than 200, it will return an error.
Sourcepub fn request(&self, method: Method, url: Url) -> RequestBuilder
pub fn request(&self, method: Method, url: Url) -> RequestBuilder
Create a new request.
Sourcepub fn get(&self, url: Url) -> RequestBuilder
pub fn get(&self, url: Url) -> RequestBuilder
Create a new GET request.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more