pub struct ClientBuilder<M>where
M: Connector,{ /* private fields */ }
Expand description
Builder for Client
s.
Instances of this are created by calling the Client::builder()
method.
Implementations§
Source§impl<M> ClientBuilder<M>where
M: Connector,
impl<M> ClientBuilder<M>where
M: Connector,
Sourcepub fn config(self, value: ClientConfig) -> Self
pub fn config(self, value: ClientConfig) -> Self
Sets a ClientConfig
to build the Client
with.
Sourcepub fn max_size(self, value: usize) -> Self
pub fn max_size(self, value: usize) -> Self
Sets the ClientConfig::max_size
.
Sourcepub fn timeouts(self, value: Timeouts) -> Self
pub fn timeouts(self, value: Timeouts) -> Self
Sets the ClientConfig::timeouts
.
Sourcepub fn wait_timeout(self, value: Option<Duration>) -> Self
pub fn wait_timeout(self, value: Option<Duration>) -> Self
Sets the Timeouts::wait
value of the ClientConfig::timeouts
.
Sourcepub fn connect_timeout(self, value: Option<Duration>) -> Self
pub fn connect_timeout(self, value: Option<Duration>) -> Self
Sets the Timeouts::connect
value of the ClientConfig::timeouts
.
Sourcepub fn reuse_timeout(self, value: Option<Duration>) -> Self
pub fn reuse_timeout(self, value: Option<Duration>) -> Self
Sets the Timeouts::reuse
value of the ClientConfig::timeouts
.
Sourcepub fn post_create(self, hook: impl Into<Hook<M>>) -> Self
pub fn post_create(self, hook: impl Into<Hook<M>>) -> Self
Attaches a post_create
hook.
The given hook
will be called each time right after a new [PooledConnection
]
has been created.
Sourcepub fn pre_reuse(self, hook: impl Into<Hook<M>>) -> Self
pub fn pre_reuse(self, hook: impl Into<Hook<M>>) -> Self
Attaches a pre_reuse
hook.
The given hook
will be called each time right before an [PooledConnection
] will
be reused.
Sourcepub fn post_reuse(self, hook: impl Into<Hook<M>>) -> Self
pub fn post_reuse(self, hook: impl Into<Hook<M>>) -> Self
Attaches a post_reuse
hook.
The given hook
will be called each time right after an [PooledConnection
] has
been reused.
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for ClientBuilder<M>where
M: Freeze,
impl<M> !RefUnwindSafe for ClientBuilder<M>
impl<M> !Send for ClientBuilder<M>
impl<M> !Sync for ClientBuilder<M>
impl<M> Unpin for ClientBuilder<M>where
M: Unpin,
impl<M> !UnwindSafe for ClientBuilder<M>
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