pub struct IndentStack {
pub allow_inconsistent_indents: bool,
/* private fields */
}
Expand description
Stores the indentation state of an off-side parser. The default state is where
Fields§
§allow_inconsistent_indents: bool
Implementations§
Source§impl IndentStack
impl IndentStack
pub fn default_inconsistent_indents() -> Self
Sourcepub fn accept(&mut self, input: &str) -> Result<isize, IndentError>
pub fn accept(&mut self, input: &str) -> Result<isize, IndentError>
Mutates the state of the stack by applying an indent level. There is no restriction on the input characters, as long as they are identical.
The initial state is an empty indent. Passing a non-empty string the first time would immediately result in an indent.
§Returns
- If an indentation error occurred,
None
is returned. Ok(1)
implies that an indent is detected.Ok(0)
implies that no indentation change is detected.Ok(x)
wherex < 0
implies that-x
levels of dedents are detected.
Trait Implementations§
Source§impl Debug for IndentStack
impl Debug for IndentStack
Source§impl Default for IndentStack
impl Default for IndentStack
Source§fn default() -> IndentStack
fn default() -> IndentStack
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IndentStack
impl RefUnwindSafe for IndentStack
impl Send for IndentStack
impl Sync for IndentStack
impl Unpin 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