pub struct PoolConstraints { /* private fields */ }
Expand description
Connection pool constraints.
This type stores min
and max
constraints for crate::Pool
and ensures that min <= max
.
Implementations§
Source§impl PoolConstraints
impl PoolConstraints
Sourcepub const fn new(min: usize, max: usize) -> Option<PoolConstraints>
pub const fn new(min: usize, max: usize) -> Option<PoolConstraints>
Creates new PoolConstraints
if constraints are valid (min <= max
).
§Connection URL
You can use pool_min
and pool_max
URL parameters to define pool constraints.
let opts = Opts::from_url("mysql://localhost/db?pool_min=0&pool_max=151")?;
assert_eq!(opts.pool_opts().constraints(), PoolConstraints::new(0, 151).unwrap());
Trait Implementations§
Source§impl Clone for PoolConstraints
impl Clone for PoolConstraints
Source§fn clone(&self) -> PoolConstraints
fn clone(&self) -> PoolConstraints
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 Debug for PoolConstraints
impl Debug for PoolConstraints
Source§impl Default for PoolConstraints
impl Default for PoolConstraints
Source§impl From<PoolConstraints> for (usize, usize)
impl From<PoolConstraints> for (usize, usize)
Source§fn from(_: PoolConstraints) -> Self
fn from(_: PoolConstraints) -> Self
Transforms constraints to a pair of (min, max)
.
Source§impl Hash for PoolConstraints
impl Hash for PoolConstraints
Source§impl PartialEq for PoolConstraints
impl PartialEq for PoolConstraints
impl Copy for PoolConstraints
impl Eq for PoolConstraints
impl StructuralPartialEq for PoolConstraints
Auto Trait Implementations§
impl Freeze for PoolConstraints
impl RefUnwindSafe for PoolConstraints
impl Send for PoolConstraints
impl Sync for PoolConstraints
impl Unpin for PoolConstraints
impl UnwindSafe for PoolConstraints
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.