Struct deadpool_sqlite::Config [−][src]
pub struct Config {
pub path: PathBuf,
pub pool: Option<PoolConfig>,
}Expand description
Configuration object.
Example (from environment)
By enabling the serde feature you can read the configuration using the
config crate as following:
SQLITE__PATH=db.sqlite3
SQLITE__POOL__MAX_SIZE=16
SQLITE__POOL__TIMEOUTS__WAIT__SECS=5
SQLITE__POOL__TIMEOUTS__WAIT__NANOS=0#[derive(serde::Deserialize, serde::Serialize)]
struct Config {
sqlite: deadpool_sqlite::Config,
}
impl Config {
pub fn from_env() -> Result<Self, config::ConfigError> {
let mut cfg = config::Config::new();
cfg.merge(config::Environment::new().separator("__")).unwrap();
cfg.try_into()
}
}Fields
path: PathBufPath to SQLite database file.
pool: Option<PoolConfig>Pool configuration.
Implementations
Create a new Config with the given path of SQLite database file.
Returns deadpool::managed::PoolConfig which can be used to construct
a deadpool::managed::Pool instance.
Trait Implementations
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 RefUnwindSafe for Config
impl UnwindSafe for Config
Blanket Implementations
Mutably borrows from an owned value. Read more