pub struct ClientPool<RM>where
RM: ResourceManager,{ /* private fields */ }Available on crate features
http and http-client-pool only.Expand description
An optioned pool of different HTTP connections lazily constructed from different URIs.
Currently supports only one domain with multiple connections.
Implementations§
Source§impl<AUX, HB, RM, SW> ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
impl<AUX, HB, RM, SW> ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
Sourcepub async fn lock<'this>(
&'this self,
uri: &UriRef<'_>,
) -> Result<SimplePoolGetElem<AsyncMutexGuard<'this, SimplePoolResource<RM::Resource>>>>where
AUX: 'this,
HB: 'this,
SW: 'this,
pub async fn lock<'this>(
&'this self,
uri: &UriRef<'_>,
) -> Result<SimplePoolGetElem<AsyncMutexGuard<'this, SimplePoolResource<RM::Resource>>>>where
AUX: 'this,
HB: 'this,
SW: 'this,
Returns a guard that contains the internal elements.
Trait Implementations§
Source§impl<RM> Clone for ClientPool<RM>where
RM: ResourceManager + Clone,
impl<RM> Clone for ClientPool<RM>where
RM: ResourceManager + Clone,
Source§fn clone(&self) -> ClientPool<RM>
fn clone(&self) -> ClientPool<RM>
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 moreSource§impl<RM> Debug for ClientPool<RM>where
RM: ResourceManager + Debug,
impl<RM> Debug for ClientPool<RM>where
RM: ResourceManager + Debug,
Source§impl<AUX, HB, RM, SW> HttpClient for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
impl<AUX, HB, RM, SW> HttpClient for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
Source§type ReqId = ClientStream<HB, SW>
type ReqId = ClientStream<HB, SW>
If applicable, can be used by clients to poll specific requests returned
by
HttpClient::send_req.Source§async fn recv_res(
&self,
rrb: ReqResBuffer,
req_id: Self::ReqId,
) -> Result<Response<ReqResBuffer>>
async fn recv_res( &self, rrb: ReqResBuffer, req_id: Self::ReqId, ) -> Result<Response<ReqResBuffer>>
Receives a response
Source§async fn send_req<RRD>(
&self,
enc_buffer: &mut Vector<u8>,
rb: ReqBuilder<RRD>,
) -> Result<Self::ReqId>
async fn send_req<RRD>( &self, enc_buffer: &mut Vector<u8>, rb: ReqBuilder<RRD>, ) -> Result<Self::ReqId>
Sends a request
Source§fn send_req_recv_res<RRD>(
&self,
rrb: ReqResBuffer,
rb: ReqBuilder<RRD>,
) -> impl Future<Output = Result<Response<ReqResBuffer>>>
fn send_req_recv_res<RRD>( &self, rrb: ReqResBuffer, rb: ReqBuilder<RRD>, ) -> impl Future<Output = Result<Response<ReqResBuffer>>>
Sends a request a
ReqResData and receives a response using ReqResBuffer.Source§impl<AUX, HB, RM, SW> HttpClient for ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
impl<AUX, HB, RM, SW> HttpClient for ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
Source§type ReqId = ClientStream<HB, SW>
type ReqId = ClientStream<HB, SW>
If applicable, can be used by clients to poll specific requests returned
by
HttpClient::send_req.Source§async fn recv_res(
&self,
rrb: ReqResBuffer,
req_id: Self::ReqId,
) -> Result<Response<ReqResBuffer>>
async fn recv_res( &self, rrb: ReqResBuffer, req_id: Self::ReqId, ) -> Result<Response<ReqResBuffer>>
Receives a response
Source§async fn send_req<RRD>(
&self,
enc_buffer: &mut Vector<u8>,
rb: ReqBuilder<RRD>,
) -> Result<Self::ReqId>
async fn send_req<RRD>( &self, enc_buffer: &mut Vector<u8>, rb: ReqBuilder<RRD>, ) -> Result<Self::ReqId>
Sends a request
Source§fn send_req_recv_res<RRD>(
&self,
rrb: ReqResBuffer,
rb: ReqBuilder<RRD>,
) -> impl Future<Output = Result<Response<ReqResBuffer>>>
fn send_req_recv_res<RRD>( &self, rrb: ReqResBuffer, rb: ReqBuilder<RRD>, ) -> impl Future<Output = Result<Response<ReqResBuffer>>>
Sends a request a
ReqResData and receives a response using ReqResBuffer.Source§impl<AUX, HB, RM, SW, TP> ReceivingTransport<TP> for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features http2 and client-api-framework only.
impl<AUX, HB, RM, SW, TP> ReceivingTransport<TP> for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features
http2 and client-api-framework only.Source§async fn recv<A, DRSR>(
&mut self,
pkgs_aux: &mut PkgsAux<A, DRSR, TP>,
req_id: Self::ReqId,
) -> Result<(), A::Error>where
A: Api,
async fn recv<A, DRSR>(
&mut self,
pkgs_aux: &mut PkgsAux<A, DRSR, TP>,
req_id: Self::ReqId,
) -> Result<(), A::Error>where
A: Api,
Retrieves data from the server filling the internal buffer and returning the amount of
bytes written.
Source§fn recv_decode_contained<'de, A, DRSR, P>(
&mut self,
pkgs_aux: &'de mut PkgsAux<A, DRSR, TP>,
req_id: Self::ReqId,
) -> impl Future<Output = Result<P::ExternalResponseContent<'de>, A::Error>>
fn recv_decode_contained<'de, A, DRSR, P>( &mut self, pkgs_aux: &'de mut PkgsAux<A, DRSR, TP>, req_id: Self::ReqId, ) -> impl Future<Output = Result<P::ExternalResponseContent<'de>, A::Error>>
Internally calls
Self::recv and then tries to decode the defined response specified
in Package::ExternalResponseContent.Source§impl<AUX, HB, RM, SW, TP> ReceivingTransport<TP> for ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features http2 and client-api-framework only.
impl<AUX, HB, RM, SW, TP> ReceivingTransport<TP> for ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features
http2 and client-api-framework only.Source§async fn recv<A, DRSR>(
&mut self,
pkgs_aux: &mut PkgsAux<A, DRSR, TP>,
req_id: Self::ReqId,
) -> Result<(), A::Error>where
A: Api,
async fn recv<A, DRSR>(
&mut self,
pkgs_aux: &mut PkgsAux<A, DRSR, TP>,
req_id: Self::ReqId,
) -> Result<(), A::Error>where
A: Api,
Retrieves data from the server filling the internal buffer and returning the amount of
bytes written.
Source§fn recv_decode_contained<'de, A, DRSR, P>(
&mut self,
pkgs_aux: &'de mut PkgsAux<A, DRSR, TP>,
req_id: Self::ReqId,
) -> impl Future<Output = Result<P::ExternalResponseContent<'de>, A::Error>>
fn recv_decode_contained<'de, A, DRSR, P>( &mut self, pkgs_aux: &'de mut PkgsAux<A, DRSR, TP>, req_id: Self::ReqId, ) -> impl Future<Output = Result<P::ExternalResponseContent<'de>, A::Error>>
Internally calls
Self::recv and then tries to decode the defined response specified
in Package::ExternalResponseContent.Source§impl<AUX, HB, RM, SW, TP> SendingTransport<TP> for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features http2 and client-api-framework only.
impl<AUX, HB, RM, SW, TP> SendingTransport<TP> for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features
http2 and client-api-framework only.Source§impl<AUX, HB, RM, SW, TP> SendingTransport<TP> for ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features http2 and client-api-framework only.
impl<AUX, HB, RM, SW, TP> SendingTransport<TP> for ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
TP: LeaseMut<HttpParams>,
Available on crate features
http2 and client-api-framework only.Source§impl<AUX, HB, RM, SW, TP> Transport<TP> for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
Available on crate features http2 and client-api-framework only.
impl<AUX, HB, RM, SW, TP> Transport<TP> for &ClientPool<RM>where
HB: LeaseMut<Http2Buffer>,
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
Available on crate features
http2 and client-api-framework only.Source§const GROUP: TransportGroup = TransportGroup::HTTP
const GROUP: TransportGroup = TransportGroup::HTTP
See TransportGroup.
Source§type ReqId = ClientStream<HB, SW>
type ReqId = ClientStream<HB, SW>
If applicable, can be used by clients to poll specific sent requests.
Source§fn ty(&self) -> TransportGroup
fn ty(&self) -> TransportGroup
Instance counterpart of
Self::GROUP.Source§impl<AUX, HB, RM, SW, TP> Transport<TP> for ClientPool<RM>where
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
Available on crate features http2 and client-api-framework only.
impl<AUX, HB, RM, SW, TP> Transport<TP> for ClientPool<RM>where
RM: ResourceManager<CreateAux = str, Error = Error, RecycleAux = str, Resource = ClientPoolResource<AUX, Http2<HB, SW, true>>>,
SW: StreamWriter,
Available on crate features
http2 and client-api-framework only.Source§const GROUP: TransportGroup = TransportGroup::HTTP
const GROUP: TransportGroup = TransportGroup::HTTP
See TransportGroup.
Source§type ReqId = ClientStream<HB, SW>
type ReqId = ClientStream<HB, SW>
If applicable, can be used by clients to poll specific sent requests.
Source§fn ty(&self) -> TransportGroup
fn ty(&self) -> TransportGroup
Instance counterpart of
Self::GROUP.Auto Trait Implementations§
impl<RM> Freeze for ClientPool<RM>
impl<RM> !RefUnwindSafe for ClientPool<RM>
impl<RM> Send for ClientPool<RM>
impl<RM> Sync for ClientPool<RM>
impl<RM> Unpin for ClientPool<RM>
impl<RM> !UnwindSafe for ClientPool<RM>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, TP> SendingReceivingTransport<TP> for Twhere
T: ReceivingTransport<TP> + SendingTransport<TP>,
impl<T, TP> SendingReceivingTransport<TP> for Twhere
T: ReceivingTransport<TP> + SendingTransport<TP>,
Source§fn send_bytes_recv<A, DRSR>(
&mut self,
bytes: &[u8],
pkgs_aux: &mut PkgsAux<A, DRSR, TP>,
) -> impl Future<Output = Result<(), A::Error>>where
A: Api,
fn send_bytes_recv<A, DRSR>(
&mut self,
bytes: &[u8],
pkgs_aux: &mut PkgsAux<A, DRSR, TP>,
) -> impl Future<Output = Result<(), A::Error>>where
A: Api,
Available on crate feature
client-api-framework only.Sends a sequence of bytes and then awaits its counterpart data response. Read more
Source§fn send_pkg_recv<A, DRSR, P>(
&mut self,
pkg: &mut P,
pkgs_aux: &mut PkgsAux<A, DRSR, TP>,
) -> impl Future<Output = Result<(), A::Error>>
fn send_pkg_recv<A, DRSR, P>( &mut self, pkg: &mut P, pkgs_aux: &mut PkgsAux<A, DRSR, TP>, ) -> impl Future<Output = Result<(), A::Error>>
Available on crate feature
client-api-framework only.Sends a package and then awaits its counterpart data response. Read more
Source§fn send_pkg_recv_decode_batch<'pkgs, 'pkgs_aux, A, DRSR, P>(
&mut self,
buffer: &mut Vector<P::ExternalResponseContent<'pkgs_aux>>,
pkgs: &'pkgs mut [P],
pkgs_aux: &'pkgs_aux mut PkgsAux<A, DRSR, TP>,
) -> impl Future<Output = Result<(), A::Error>>
fn send_pkg_recv_decode_batch<'pkgs, 'pkgs_aux, A, DRSR, P>( &mut self, buffer: &mut Vector<P::ExternalResponseContent<'pkgs_aux>>, pkgs: &'pkgs mut [P], pkgs_aux: &'pkgs_aux mut PkgsAux<A, DRSR, TP>, ) -> impl Future<Output = Result<(), A::Error>>
Available on crate feature
client-api-framework only.Convenient method similar to
Self::send_pkg_recv_decode_contained but used for batch
requests. Read moreSource§fn send_pkg_recv_decode_contained<'de, A, DRSR, P>(
&mut self,
pkg: &mut P,
pkgs_aux: &'de mut PkgsAux<A, DRSR, TP>,
) -> impl Future<Output = Result<P::ExternalResponseContent<'de>, A::Error>>
fn send_pkg_recv_decode_contained<'de, A, DRSR, P>( &mut self, pkg: &mut P, pkgs_aux: &'de mut PkgsAux<A, DRSR, TP>, ) -> impl Future<Output = Result<P::ExternalResponseContent<'de>, A::Error>>
Available on crate feature
client-api-framework only.Internally calls
Self::send_pkg_recv and then tries to decode the defined response specified
in Package::ExternalResponseContent.