Struct Options
pub struct Options {
pub idle_timeout: Duration,
pub connect_timeout: Duration,
pub max_connections: usize,
pub on_connected: Option<Arc<dyn Fn(&Endpoint, &Connection) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send>>,
}Expand description
Configuration options for the connection pool
Fields§
§idle_timeout: DurationHow long to keep idle connections around.
connect_timeout: DurationTimeout for connect. This includes the time spent in on_connect, if set.
max_connections: usizeMaximum number of connections to hand out.
on_connected: Option<Arc<dyn Fn(&Endpoint, &Connection) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send>>An optional callback that can be used to wait for the connection to enter some state. An example usage could be to wait for the connection to become direct before handing it out to the user.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Options
impl !RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl !UnwindSafe for Options
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,
§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>
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