[−][src]Struct winnow_sm::Env
User-defined variables
Methods
impl Env[src]
pub fn get_variable(&self, variable_name: &str) -> String[src]
Retrieve the value stored at variable_name.
pub fn set_variable(&mut self, variable_name: &str, value: String)[src]
Set variable_name to value, always overwrites
pub fn resolve_template(&self, template: &str) -> String[src]
Resolve a string template
Example
env.set_variable("NAME", "Al Gore".into()); env.set_variable("COLOR", "Green".into()); let template = "Hi there, $NAME, seen anything $COLOR lately?"; let expected = "Hi there, Al Gore, seen anything Green lately?";
If variable is not set, variable name will be used:
let template = "Hi there, $NAME, how is $TOPIC?"; let expected = "Hi there, Al Gore, how is TOPIC?";
Trait Implementations
Auto Trait Implementations
impl Send for Env
impl Unpin for Env
impl Sync for Env
impl UnwindSafe for Env
impl RefUnwindSafe for Env
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,