Enum yash_syntax::syntax::TextUnit
source · [−]pub enum TextUnit {
Literal(char),
Backslashed(char),
RawParam {
name: String,
location: Location,
},
BracedParam(Param),
CommandSubst {
content: String,
location: Location,
},
Backquote {
content: Vec<BackquoteUnit>,
location: Location,
},
Arith {
content: Text,
location: Location,
},
}
Expand description
Element of a Text, i.e., something that can be expanded.
Variants
Literal(char)
Literal single character.
Backslashed(char)
Backslash-escaped single character.
RawParam
Fields
name: String
Parameter name.
location: Location
Position of this parameter expansion in the source code.
Parameter expansion that is not enclosed in braces.
BracedParam(Param)
Parameter expansion that is enclosed in braces.
CommandSubst
Fields
content: String
Command string that will be parsed and executed when the command substitution is expanded.
location: Location
Position of this command substitution in the source code.
Command substitution of the form $(...)
.
Backquote
Fields
content: Vec<BackquoteUnit>
Command string that will be parsed and executed when the command substitution is expanded.
location: Location
Position of this command substitution in the source code.
Command substitution of the form `...`
.
Arith
Fields
content: Text
Expression that is to be evaluated.
location: Location
Position of this arithmetic expansion in the source code.
Arithmetic expansion.
Trait Implementations
sourceimpl MaybeLiteral for TextUnit
impl MaybeLiteral for TextUnit
sourcefn extend_if_literal<T: Extend<char>>(&self, result: T) -> Result<T, T>
fn extend_if_literal<T: Extend<char>>(&self, result: T) -> Result<T, T>
If self
is Literal
, appends the character to result
and returns
Ok(result)
. Otherwise, returns Err(result)
.
sourcefn to_string_if_literal(&self) -> Option<String>
fn to_string_if_literal(&self) -> Option<String>
Checks if self
is literal and, if so, converts to a string.
impl Eq for TextUnit
impl StructuralEq for TextUnit
impl StructuralPartialEq for TextUnit
Auto Trait Implementations
impl !RefUnwindSafe for TextUnit
impl !Send for TextUnit
impl !Sync for TextUnit
impl Unpin for TextUnit
impl !UnwindSafe for TextUnit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more