pub struct IndentStack {
pub stack: Vec<IndentLevel>,
pub tab_width: usize,
}Expand description
A stack of indentation levels used during parsing.
Fields§
§stack: Vec<IndentLevel>§tab_width: usizeImplementations§
Source§impl IndentStack
impl IndentStack
pub fn new(tab_width: usize) -> Self
pub fn push(&mut self, level: IndentLevel)
pub fn pop(&mut self) -> Option<IndentLevel>
Sourcepub fn current(&self) -> Option<&IndentLevel>
pub fn current(&self) -> Option<&IndentLevel>
Return a reference to the current (top) indentation level.
Sourcepub fn dedent_to(&mut self, level: &IndentLevel) -> usize
pub fn dedent_to(&mut self, level: &IndentLevel) -> usize
Pop levels from the stack until the top is at or below level.
Returns the number of levels popped.
Auto Trait Implementations§
impl Freeze for IndentStack
impl RefUnwindSafe for IndentStack
impl Send for IndentStack
impl Sync for IndentStack
impl Unpin for IndentStack
impl UnsafeUnpin for IndentStack
impl UnwindSafe for IndentStack
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