pub struct GenerationPool { /* private fields */ }Expand description
An HTTP client whose connection pool belongs to one path generation.
reqwest has no way to empty a pool, so a new generation builds a new client and drops the
old one: no request on the new path rides a connection dialled over the old one. In-flight
requests keep the clone they hold until they end.
Implementations§
Source§impl GenerationPool
impl GenerationPool
Sourcepub fn new(build: impl Fn() -> Result<Client> + Send + Sync + 'static) -> Self
pub fn new(build: impl Fn() -> Result<Client> + Send + Sync + 'static) -> Self
A pool whose clients come from build, which must start from
http_builder so every client carries the handshake.
Sourcepub fn sdk() -> Self
pub fn sdk() -> Self
A pool of http_clients: the SDK’s one client shape.
Sourcepub fn generation(&self) -> Option<PathGeneration>
pub fn generation(&self) -> Option<PathGeneration>
The generation the held client was built for, if one has been built.
Sourcepub fn client(&self, generation: PathGeneration) -> Result<Client>
pub fn client(&self, generation: PathGeneration) -> Result<Client>
The client for generation: the held one while the generation is unchanged, a fresh one
— dropping the old pool — once it moves.
§Errors
Whatever building the fresh client refused with; the held client, if any, is kept, so the next call tries again.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GenerationPool
impl !RefUnwindSafe for GenerationPool
impl !UnwindSafe for GenerationPool
impl Send for GenerationPool
impl Sync for GenerationPool
impl Unpin for GenerationPool
impl UnsafeUnpin for GenerationPool
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more