pub struct DefaultClient {
pub with_upgrades: bool,
/* private fields */
}
Expand description
Default HTTP client for this crate
Fields§
§with_upgrades: bool
If true, send_request will returns an Upgraded struct when the response is an upgrade If false, send_request never returns an Upgraded struct and just copy bidirectional when the response is an upgrade
Implementations§
Source§impl DefaultClient
impl DefaultClient
pub fn new() -> Self
pub fn try_new() -> Result<Self, Error>
Sourcepub fn with_upgrades(self) -> Self
pub fn with_upgrades(self) -> Self
Enable HTTP upgrades If you don’t enable HTTP upgrades, send_request will just copy bidirectional when the response is an upgrade
Sourcepub async fn send_request<B>(
&self,
req: Request<B>,
) -> Result<(Response<Incoming>, Option<JoinHandle<Result<Upgraded, Error>>>), Error>
pub async fn send_request<B>( &self, req: Request<B>, ) -> Result<(Response<Incoming>, Option<JoinHandle<Result<Upgraded, Error>>>), Error>
Send a request and return a response. If the response is an upgrade (= if status code is 101 Switching Protocols), it will return a response and an Upgrade struct. Request should have a full URL including scheme.
Trait Implementations§
Source§impl Clone for DefaultClient
impl Clone for DefaultClient
Source§fn clone(&self) -> DefaultClient
fn clone(&self) -> DefaultClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DefaultClient
impl RefUnwindSafe for DefaultClient
impl Send for DefaultClient
impl Sync for DefaultClient
impl Unpin for DefaultClient
impl UnwindSafe for DefaultClient
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