Trait ca_formats::Input[][src]

pub trait Input {
    type Lines: Iterator;
    type Line: AsRef<str>;
    type Bytes: Iterator<Item = u8>;
    fn lines(self) -> Self::Lines;
fn line(item: <Self::Lines as Iterator>::Item) -> Result<Self::Line, Error>;
fn bytes(line: Self::Line) -> Self::Bytes; }

Types that can be passed to parsers as input.

The trait is implemented for &str and BufReader. When parsing a file, you can take a BufReader<File> as input.

Associated Types

type Lines: Iterator[src]

An iterator over lines of the input.

type Line: AsRef<str>[src]

A string or a reference to a string, which represents a line of the input.

type Bytes: Iterator<Item = u8>[src]

An iterator over bytes of a line.

Loading content...

Required methods

fn lines(self) -> Self::Lines[src]

Creates an iterator over lines from the input.

fn line(item: <Self::Lines as Iterator>::Item) -> Result<Self::Line, Error>[src]

Converts a item in the lines iterator to a string.

fn bytes(line: Self::Line) -> Self::Bytes[src]

Creates an iterator over bytes from a line.

Loading content...

Implementations on Foreign Types

impl<'a> Input for &'a str[src]

type Lines = Lines<'a>

type Line = &'a str

type Bytes = Bytes<'a>

impl<'a> Input for Lines<'a>[src]

type Lines = Lines<'a>

type Line = &'a str

type Bytes = Bytes<'a>

impl<R: Read> Input for BufReader<R>[src]

type Lines = IoLines<BufReader<R>>

type Line = String

type Bytes = IntoIter<u8>

impl<B: BufRead> Input for IoLines<B>[src]

type Lines = IoLines<B>

type Line = String

type Bytes = IntoIter<u8>

Loading content...

Implementors

Loading content...