Enum conch_parser::ast::ParameterSubstitution
[−]
[src]
pub enum ParameterSubstitution<P, W, C, A> {
Command(Vec<C>),
Len(P),
Arith(Option<A>),
Default(bool, P, Option<W>),
Assign(bool, P, Option<W>),
Error(bool, P, Option<W>),
Alternative(bool, P, Option<W>),
RemoveSmallestSuffix(P, Option<W>),
RemoveLargestSuffix(P, Option<W>),
RemoveSmallestPrefix(P, Option<W>),
RemoveLargestPrefix(P, Option<W>),
}A parameter substitution, e.g. ${param-word}.
Generic over the representations of parameters, shell words and commands, and arithmetic expansions.
Variants
Command(Vec<C>)Returns the standard output of running a command, e.g. $(cmd)
Len(P)Returns the length of the value of a parameter, e.g. ${#param}
Arith(Option<A>)Returns the resulting value of an arithmetic subsitution, e.g. $(( x++ ))
Default(bool, P, Option<W>)Use a provided value if the parameter is null or unset, e.g.
${param:-[word]}.
The boolean indicates the presence of a :, and that if the parameter has
a null value, that situation should be treated as if the parameter is unset.
Assign(bool, P, Option<W>)Assign a provided value to the parameter if it is null or unset,
e.g. ${param:=[word]}.
The boolean indicates the presence of a :, and that if the parameter has
a null value, that situation should be treated as if the parameter is unset.
Error(bool, P, Option<W>)If the parameter is null or unset, an error should result with the provided
message, e.g. ${param:?[word]}.
The boolean indicates the presence of a :, and that if the parameter has
a null value, that situation should be treated as if the parameter is unset.
Alternative(bool, P, Option<W>)If the parameter is NOT null or unset, a provided word will be used,
e.g. ${param:+[word]}.
The boolean indicates the presence of a :, and that if the parameter has
a null value, that situation should be treated as if the parameter is unset.
RemoveSmallestSuffix(P, Option<W>)Remove smallest suffix pattern from a parameter's value, e.g. ${param%pattern}
RemoveLargestSuffix(P, Option<W>)Remove largest suffix pattern from a parameter's value, e.g. ${param%%pattern}
RemoveSmallestPrefix(P, Option<W>)Remove smallest prefix pattern from a parameter's value, e.g. ${param#pattern}
RemoveLargestPrefix(P, Option<W>)Remove largest prefix pattern from a parameter's value, e.g. ${param##pattern}
Trait Implementations
impl<P: Debug, W: Debug, C: Debug, A: Debug> Debug for ParameterSubstitution<P, W, C, A>[src]
impl<P: PartialEq, W: PartialEq, C: PartialEq, A: PartialEq> PartialEq for ParameterSubstitution<P, W, C, A>[src]
fn eq(&self, __arg_0: &ParameterSubstitution<P, W, C, A>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &ParameterSubstitution<P, W, C, A>) -> bool
This method tests for !=.
impl<P: Eq, W: Eq, C: Eq, A: Eq> Eq for ParameterSubstitution<P, W, C, A>[src]
impl<P: Clone, W: Clone, C: Clone, A: Clone> Clone for ParameterSubstitution<P, W, C, A>[src]
fn clone(&self) -> ParameterSubstitution<P, W, C, A>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more