Label

Trait Label 

Source
pub trait Label {
    type LabelError;

    // Required method
    fn push(&mut self, found: char) -> Result<Option<char>, Self::LabelError>;

    // Provided method
    fn complete(&mut self) -> Result<Option<char>, Self::LabelError> { ... }
}
Expand description

A trait for extracting the label from a boundary

Required Associated Types§

Source

type LabelError

The type of any errors which might occur while accumulating the label

Required Methods§

Source

fn push(&mut self, found: char) -> Result<Option<char>, Self::LabelError>

Adds a character to the label. If it returns an error, the parsing process will terminate.

A return value of Ok(Some(found)) means the label was expected to end. A return value of Ok(Some(expected)) means a Mismatch error occured.

Provided Methods§

Source

fn complete(&mut self) -> Result<Option<char>, Self::LabelError>

Signals that the label is complete because a double '-' was reached.

Defaults to Ok(None). A return value of Ok(Some(expected)) is interpreted as a Mismatch error. A return value of Ok(Some('-')) is invalid and reserved for future use.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + Extend<char>> Label for &'a mut T

Source§

type LabelError = Void

Source§

fn push(&mut self, found: char) -> Result<Option<char>, Self::LabelError>

Implementors§