Skip to main content

Input

Trait Input 

Source
pub trait Input: Default {
    type Position: Position;
    type Error: Error<Position = Self::Position>;

    // Required methods
    fn next(
        &self,
        pos: Self::Position,
    ) -> Result<(char, Self::Position), Self::Error>;
    fn next_range(
        &self,
        start: Self::Position,
        counts: u32,
    ) -> Result<(&str, Self::Position), Self::Error>;
    fn error_at(&self, pos: Self::Position, reason: &'static str) -> Self::Error;
    fn is_end(&self, pos: Self::Position) -> bool;
}

Required Associated Types§

Source

type Position: Position

Source

type Error: Error<Position = Self::Position>

Required Methods§

Source

fn next( &self, pos: Self::Position, ) -> Result<(char, Self::Position), Self::Error>

Source

fn next_range( &self, start: Self::Position, counts: u32, ) -> Result<(&str, Self::Position), Self::Error>

Source

fn error_at(&self, pos: Self::Position, reason: &'static str) -> Self::Error

Source

fn is_end(&self, pos: Self::Position) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Input for &str

Source§

type Position = SimplePosition

Source§

type Error = SimpleError

Source§

fn next( &self, pos: Self::Position, ) -> Result<(char, Self::Position), Self::Error>

Source§

fn next_range( &self, start: Self::Position, counts: u32, ) -> Result<(&str, Self::Position), Self::Error>

Source§

fn error_at(&self, pos: Self::Position, reason: &'static str) -> Self::Error

Source§

fn is_end(&self, pos: Self::Position) -> bool

Implementors§