[][src]Struct manaconf::sources::EnvVarSource

pub struct EnvVarSource { /* fields omitted */ }

A config value source that fetches values from environment variables

The source can be supplied with a prefix for environment variables by using with_prefix.

Environment variable names, are thus then constructed as PREFIX_COMPONENT_COMPONENT_COMPONENT

If there is no prefix then it's just COMPONENT_COMPONENT_COMPONENT

i.e. If the source has a prefix of MYCONFIG and you requested a value with the key database::connection_string. The environment variable that is looked up would be MYCONFIG_DATABASE_CONNECTION_STRING

It is worth noting, however, that this scheme may cause conflicts as the key database::connection_string and database::connection::string would result in the same environment variable DATABASE_CONNECTION_STRING.

Implementations

impl EnvVarSource[src]

pub fn new() -> Self[src]

Creates an environment variable source

pub fn with_prefix<T: Into<String>>(prefix: T) -> Self[src]

Creates an environment source with a given prefix to the environment variables name.

Trait Implementations

impl Source for EnvVarSource[src]

type Error = VarError

The error type used by this Source

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.