pub enum ParameterSubstitutionKind<W, C> {
Command(CommandGroup<C>),
Len(DefaultParameter),
Arith(Option<DefaultArithmetic>),
Default(bool, DefaultParameter, Option<W>),
Assign(bool, DefaultParameter, Option<W>),
Error(bool, DefaultParameter, Option<W>),
Alternative(bool, DefaultParameter, Option<W>),
RemoveSmallestSuffix(DefaultParameter, Option<W>),
RemoveLargestSuffix(DefaultParameter, Option<W>),
RemoveSmallestPrefix(DefaultParameter, Option<W>),
RemoveLargestPrefix(DefaultParameter, Option<W>),
}
Expand description
Represents the type of parameter that was parsed
Variants§
Command(CommandGroup<C>)
Returns the standard output of running a command, e.g. $(cmd)
Len(DefaultParameter)
Returns the length of the value of a parameter, e.g. ${#param}
Arith(Option<DefaultArithmetic>)
Returns the resulting value of an arithmetic subsitution, e.g. $(( x++ ))
Default(bool, DefaultParameter, 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, DefaultParameter, 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, DefaultParameter, 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, DefaultParameter, 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(DefaultParameter, Option<W>)
Remove smallest suffix pattern, e.g. ${param%pattern}
RemoveLargestSuffix(DefaultParameter, Option<W>)
Remove largest suffix pattern, e.g. ${param%%pattern}
RemoveSmallestPrefix(DefaultParameter, Option<W>)
Remove smallest prefix pattern, e.g. ${param#pattern}
RemoveLargestPrefix(DefaultParameter, Option<W>)
Remove largest prefix pattern, e.g. ${param##pattern}
Trait Implementations§
Source§impl<W: Clone, C: Clone> Clone for ParameterSubstitutionKind<W, C>
impl<W: Clone, C: Clone> Clone for ParameterSubstitutionKind<W, C>
Source§fn clone(&self) -> ParameterSubstitutionKind<W, C>
fn clone(&self) -> ParameterSubstitutionKind<W, C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<W: PartialEq, C: PartialEq> PartialEq for ParameterSubstitutionKind<W, C>
impl<W: PartialEq, C: PartialEq> PartialEq for ParameterSubstitutionKind<W, C>
Source§fn eq(&self, other: &ParameterSubstitutionKind<W, C>) -> bool
fn eq(&self, other: &ParameterSubstitutionKind<W, C>) -> bool
self
and other
values to be equal, and is used by ==
.