pub struct DatabaseConfiguration {
pub driver: DatabaseDriver,
pub min_connections: u32,
pub max_connections: u32,
}
Expand description
Configuration use in Database::connect
.
Fields§
§driver: DatabaseDriver
The driver and its corresponding settings
min_connections: u32
Minimal connections to initialize upfront.
Must be greater than 0
and can’t be larger than max_connections
.
max_connections: u32
Maximum connections that allowed to be created.
Must be greater than 0
.
Implementations§
Source§impl DatabaseConfiguration
impl DatabaseConfiguration
Sourcepub fn new(driver: DatabaseDriver) -> Self
pub fn new(driver: DatabaseDriver) -> Self
Create a new database configuration with some defaults set.
Defaults:
min_connections
: 1max_connections
: 10
Parameter:
driver
:DatabaseDriver
: Configuration of the database driver.
Trait Implementations§
Source§impl Debug for DatabaseConfiguration
impl Debug for DatabaseConfiguration
Source§impl<'de> Deserialize<'de> for DatabaseConfiguration
impl<'de> Deserialize<'de> for DatabaseConfiguration
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DatabaseConfiguration
impl RefUnwindSafe for DatabaseConfiguration
impl Send for DatabaseConfiguration
impl Sync for DatabaseConfiguration
impl Unpin for DatabaseConfiguration
impl UnwindSafe for DatabaseConfiguration
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> 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