pub struct Config { /* private fields */ }
Implementations§
source§impl Config
impl Config
sourcepub fn new(db_type: ConfigDbType) -> Config
pub fn new(db_type: ConfigDbType) -> Config
create a new config instance
sourcepub fn from_env_var(name: &str) -> Result<Config, Error>
pub fn from_env_var(name: &str) -> Result<Config, Error>
create a new Config instance from an environment variable that contains a URL
sourcepub fn from_file_location<T>(location: T) -> Result<Config, Error>
pub fn from_file_location<T>(location: T) -> Result<Config, Error>
create a new Config instance from a config file located on the file system
pub fn db_type(&self) -> ConfigDbType
pub fn db_host(&self) -> Option<&str>
pub fn db_port(&self) -> Option<&str>
pub fn set_db_user(self, db_user: &str) -> Config
pub fn set_db_pass(self, db_pass: &str) -> Config
pub fn set_db_host(self, db_host: &str) -> Config
pub fn set_db_port(self, db_port: &str) -> Config
pub fn set_db_name(self, db_name: &str) -> Config
Trait Implementations§
source§impl AsyncTransaction for Config
impl AsyncTransaction for Config
type Error = Infallible
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
_queries: &'life1 [&'life2 str]
) -> Pin<Box<dyn Future<Output = Result<usize, <Config as AsyncTransaction>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Config: 'async_trait,
source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Config, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Serialize for Config
impl Serialize for Config
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl Transaction for Config
impl Transaction for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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