Struct salak::PlaceholderResolver[][src]

pub struct PlaceholderResolver<T: Environment> { /* fields omitted */ }

An implementation of Environment that can resolve placeholder for values.

use salak::*;
std::env::set_var("v1", "value");
std::env::set_var("v2", "{v1}");
std::env::set_var("v3", "{no_found:default}");
std::env::set_var("v4", "{no_found:{v2}}");
let env = PlaceholderResolver::new(true, SourceRegistry::default());
assert_eq!("value", &env.require::<String>("v1").unwrap());
assert_eq!("value", &env.require::<String>("v2").unwrap());
assert_eq!("default", &env.require::<String>("v3").unwrap());
assert_eq!("value", &env.require::<String>("v4").unwrap());

Implementations

impl<E: Environment> PlaceholderResolver<E>[src]

pub fn new(enabled: bool, env: E) -> Self[src]

Trait Implementations

impl<E: Environment> Environment for PlaceholderResolver<E>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for PlaceholderResolver<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for PlaceholderResolver<T>[src]

impl<T> Sync for PlaceholderResolver<T>[src]

impl<T> Unpin for PlaceholderResolver<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for PlaceholderResolver<T> where
    T: UnwindSafe
[src]

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.