Enum conch_runtime::eval::Fields
[−]
[src]
pub enum Fields<T> {
Zero,
Single(T),
At(Vec<T>),
Star(Vec<T>),
Split(Vec<T>),
}Represents the types of fields that may result from evaluating a word.
It is important to maintain such distinctions because evaluating parameters
such as $@ and $* have different behaviors in different contexts.
Variants
ZeroNo fields, distinct from present-but-null fields.
Single(T)A single field.
At(Vec<T>)Any number of fields resulting from evaluating the $@ special parameter.
Star(Vec<T>)Any number of fields resulting from evaluating the $* special parameter.
Split(Vec<T>)A non-zero number of fields resulting from splitting, and which do not have any special meaning.
Methods
impl<T: StringWrapper> Fields<T>[src]
fn is_null(&self) -> bool[src]
Indicates if a set of fields is considered null.
A set of fields is null if every single string it holds is the empty string.
fn join(self) -> T[src]
Joins all fields using a space.
Note: Zero is treated as a empty-but-present field for simplicity.
fn join_with_ifs<E: ?Sized>(self, env: &E) -> T where
E: VariableEnvironment,
E::VarName: Borrow<String>,
E::Var: Borrow<String>, [src]
E: VariableEnvironment,
E::VarName: Borrow<String>,
E::Var: Borrow<String>,
Joins any field unconditionally with the first character of $IFS.
If $IFS is unset, fields are joined with a space, or concatenated
if $IFS is empty.
Note: Zero is treated as a empty-but-present field for simplicity.
fn split<E: ?Sized>(self, env: &E) -> Fields<T> where
E: VariableEnvironment,
E::VarName: Borrow<String>,
E::Var: Borrow<String>, [src]
E: VariableEnvironment,
E::VarName: Borrow<String>,
E::Var: Borrow<String>,
Splits a vector of fields further based on the contents of the IFS
variable (i.e. as long as it is non-empty). Any empty fields, original
or otherwise created will be discarded.
Trait Implementations
impl<T: PartialEq> PartialEq for Fields<T>[src]
fn eq(&self, __arg_0: &Fields<T>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Fields<T>) -> bool[src]
This method tests for !=.
impl<T: Eq> Eq for Fields<T>[src]
impl<T: Clone> Clone for Fields<T>[src]
fn clone(&self) -> Fields<T>[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more