Struct salak::PlaceholderResolver [−][src]
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]
Trait Implementations
impl<T: Debug + Environment> Debug for PlaceholderResolver<T>
[src]
impl<E: Environment> Environment for PlaceholderResolver<E>
[src]
fn contains(&self, name: &str) -> bool
[src]
fn require<T>(&self, name: &str) -> Result<T, PropertyError> where
T: FromEnvironment,
[src]
T: FromEnvironment,
fn resolve_placeholder(
&self,
value: String
) -> Result<Option<Property>, PropertyError>
[src]
&self,
value: String
) -> Result<Option<Property>, PropertyError>
fn find_keys(&self, prefix: &str) -> Vec<String>
[src]
fn reload(&mut self) -> Result<(), PropertyError>
[src]
fn require_or<T: FromEnvironment>(
&self,
key: &str,
default: T
) -> Result<T, PropertyError>
[src]
&self,
key: &str,
default: T
) -> Result<T, PropertyError>
fn get<T: FromEnvironment>(&self, key: &str) -> Option<T>
[src]
fn get_or<T: FromEnvironment>(&self, key: &str, default: T) -> T
[src]
fn load_config<T: DefaultSourceFromEnvironment>(
&self
) -> Result<T, PropertyError>
[src]
&self
) -> Result<T, PropertyError>
Auto Trait Implementations
impl<T> RefUnwindSafe for PlaceholderResolver<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for PlaceholderResolver<T>
impl<T> Sync for PlaceholderResolver<T>
impl<T> Unpin for PlaceholderResolver<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for PlaceholderResolver<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,