Struct refinery::config::Config

source ·
pub struct Config { /* private fields */ }

Implementations§

source§

impl Config

source

pub fn new(db_type: ConfigDbType) -> Config

create a new config instance

source

pub fn from_env_var(name: &str) -> Result<Config, Error>

create a new Config instance from an environment variable that contains a URL

source

pub fn from_file_location<T>(location: T) -> Result<Config, Error>
where T: AsRef<Path>,

create a new Config instance from a config file located on the file system

source

pub fn db_type(&self) -> ConfigDbType

source

pub fn db_host(&self) -> Option<&str>

source

pub fn db_port(&self) -> Option<&str>

source

pub fn set_db_user(self, db_user: &str) -> Config

source

pub fn set_db_pass(self, db_pass: &str) -> Config

source

pub fn set_db_host(self, db_host: &str) -> Config

source

pub fn set_db_port(self, db_port: &str) -> Config

source

pub fn set_db_name(self, db_name: &str) -> Config

Trait Implementations§

source§

impl AsyncQuery<Vec<Migration>> for Config

source§

fn query<'life0, 'life1, 'async_trait>( &'life0 mut self, _query: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Vec<Migration>, <Config as AsyncTransaction>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Config: 'async_trait,

source§

impl AsyncTransaction for Config

§

type Error = Infallible

source§

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 Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Config

source§

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 FromStr for Config

source§

fn from_str(url_str: &str) -> Result<Config, <Config as FromStr>::Err>

create a new Config instance from a string that contains a URL

§

type Err = Error

The associated error which can be returned from parsing.
source§

impl Query<Vec<Migration>> for Config

source§

fn query( &mut self, _query: &str ) -> Result<Vec<Migration>, <Config as Transaction>::Error>

source§

impl Serialize for Config

source§

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

§

type Error = Infallible

source§

fn execute( &mut self, _queries: &[&str] ) -> Result<usize, <Config as Transaction>::Error>

source§

impl TryFrom<Url> for Config

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(url: Url) -> Result<Config, <Config as TryFrom<Url>>::Error>

Performs the conversion.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,