pub enum Unit {
Symbol(Box<str>, Span),
Parser(Parser),
}Expand description
Some unit, which represents an intermediate state.
Variants§
Symbol(Box<str>, Span)
The current unit is a single symbol.
Parser(Parser)
The current unit is a parser, which can yield multiple units.
Implementations§
Source§impl Unit
impl Unit
Sourcepub fn symbol(self) -> Result<Box<str>>
pub fn symbol(self) -> Result<Box<str>>
Returns the symbol, if applicable, as a result type.
§Errors
Returns an error if this unit is a parser (a sublist), not a symbol.
Sourcepub fn parser(self) -> Result<Parser>
pub fn parser(self) -> Result<Parser>
Returns the parser, if applicable, as a result type.
§Errors
Returns an error if this unit is a symbol, not a parser.
Sourcepub fn substitute(&mut self, variable: &str, value: &str)
pub fn substitute(&mut self, variable: &str, value: &str)
Replaces all occurrences of a symbol with another symbol, recursively.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnsafeUnpin for Unit
impl UnwindSafe for Unit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more