pub struct DynHttpClient { /* private fields */ }Expand description
A type-erased, cheaply cloneable HTTP transport.
Clones share the transport and middleware instances but copy the middleware
list. Erasing an already erased transport clones it without another layer.
Debug prints only the type name to avoid exposing transport credentials.
The transport is not serializable.
ⓘ
fn assert_serialize<T: serde::Serialize>() {}
assert_serialize::<rig_http::http_client::DynHttpClient>();Implementations§
Source§impl DynHttpClient
impl DynHttpClient
Sourcepub fn new<H>(http: H) -> Selfwhere
H: HttpClientExt + 'static,
pub fn new<H>(http: H) -> Selfwhere
H: HttpClientExt + 'static,
Erase http. If http is already a DynHttpClient, this is a clone
(its attached middleware included).
Sourcepub fn with_middleware<M>(self, middleware: M) -> Selfwhere
M: HttpMiddleware + 'static,
pub fn with_middleware<M>(self, middleware: M) -> Selfwhere
M: HttpMiddleware + 'static,
Attach a transport-boundary HttpMiddleware to this handle.
Hooks run in attachment order with the phases defined by HttpMiddleware.
Existing clones keep their previous stack. The underlying transport stays
shared, so Self::ptr_eq is unaffected.
Trait Implementations§
Source§impl Clone for DynHttpClient
impl Clone for DynHttpClient
Source§impl Debug for DynHttpClient
impl Debug for DynHttpClient
Source§impl HttpClientExt for DynHttpClient
impl HttpClientExt for DynHttpClient
Source§fn send<T, U>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
fn send<T, U>( &self, req: Request<T>, ) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
Sends a request and returns headers with a lazy body converted from bytes to
U.Source§fn send_multipart<U>(
&self,
req: Request<MultipartForm>,
) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
fn send_multipart<U>( &self, req: Request<MultipartForm>, ) -> impl Future<Output = Result<Response<LazyBody<U>>>> + WasmCompatSend + 'static
Sends a multipart request and returns headers with a lazy body converted to
U.Source§fn send_streaming<T>(
&self,
req: Request<T>,
) -> impl Future<Output = Result<StreamingResponse>> + WasmCompatSend
fn send_streaming<T>( &self, req: Request<T>, ) -> impl Future<Output = Result<StreamingResponse>> + WasmCompatSend
Sends a request and returns headers with a stream of transport byte chunks.
Auto Trait Implementations§
impl !RefUnwindSafe for DynHttpClient
impl !UnwindSafe for DynHttpClient
impl Freeze for DynHttpClient
impl Send for DynHttpClient
impl Sync for DynHttpClient
impl Unpin for DynHttpClient
impl UnsafeUnpin for DynHttpClient
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