pub struct Pool { /* private fields */ }Expand description
Bounded pool of connections to one server. Opens nothing until the first checkout.
Implementations§
Source§impl Pool
impl Pool
Sourcepub fn new(connect: ConnectConfig, max_connections: usize) -> Pool
pub fn new(connect: ConnectConfig, max_connections: usize) -> Pool
Lazy: opens nothing until first use. Authenticates with the default policy.
Sourcepub fn with_auth(
connect: ConnectConfig,
max_connections: usize,
auth: AuthPolicy,
) -> Pool
pub fn with_auth( connect: ConnectConfig, max_connections: usize, auth: AuthPolicy, ) -> Pool
Like new, with the authentication methods every new connection may use.
Sourcepub fn with_name(self, name: &str) -> Pool
pub fn with_name(self, name: &str) -> Pool
Sets the configured connection name that the failure log reports.
Sourcepub fn with_tls(self, tls: Option<Arc<ClientConfig>>) -> Pool
pub fn with_tls(self, tls: Option<Arc<ClientConfig>>) -> Pool
Uses tls for every new connection instead of reading the root file again.
Sourcepub async fn checkout(&self, wait: Duration) -> Result<Lease<'_>, PoolError>
pub async fn checkout(&self, wait: Duration) -> Result<Lease<'_>, PoolError>
Waits for a permit (at most wait), then reuses an idle connection or opens a new one.
pub fn type_cache(&self) -> &TypeCache
pub fn idle_count(&self) -> usize
Auto Trait Implementations§
impl !Freeze for Pool
impl !RefUnwindSafe for Pool
impl !UnwindSafe for Pool
impl Forget for Pool
impl Move for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl UnsafeUnpin for Pool
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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> ⓘ
Converts
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> ⓘ
Converts
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