[][src]Struct indent_stack::IndentStack

pub struct IndentStack {
    pub allow_inconsistent_indents: bool,
    // some fields omitted
}

Stores the indentation state of an off-side parser. The default state is where

Fields

allow_inconsistent_indents: bool

Methods

impl IndentStack[src]

pub fn default_inconsistent_indents() -> Self[src]

pub fn accept(&mut self, input: &str) -> Result<isize, IndentError>[src]

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) where x < 0 implies that -x levels of dedents are detected.

Trait Implementations

impl Default for IndentStack[src]

impl Debug for IndentStack[src]

Auto Trait Implementations

impl Send for IndentStack

impl Sync for IndentStack

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]