[][src]Struct weave::Parser

pub struct Parser<S: Sink, B> { /* fields omitted */ }

A Parser is used to process a weave file, extracting either everything, or only a specific delta.

Methods

impl<S: Sink> Parser<S, BufReader<Box<dyn Read>>>[src]

pub fn new(
    naming: &dyn NamingConvention,
    sink: S,
    delta: usize
) -> Result<Parser<S, BufReader<Box<dyn Read>>>>
[src]

Construct a parser, based on the main file of the naming convention.

impl<S: Sink, B: BufRead> Parser<S, B>[src]

pub fn new_raw(
    source: Lines<B>,
    sink: Rc<RefCell<S>>,
    delta: usize
) -> Result<Parser<S, B>>
[src]

Construct a new Parser, reading from the given Reader, giving records to the given Sink, and aiming for the specified delta. This is not the intended constructor, normal users should use new. (This is public, for testing).

pub fn parse_to(&mut self, lineno: usize) -> Result<usize>[src]

Run the parser until we either reach the given line number, or the end of the weave. Lines are numbered from 1, so calling with a lineno of zero will run the parser until the end of the input. Returns Ok(0) for the end of input, Ok(n) for stopping at line n (which should always be the same as the passed in lineno, or Err if there is an error.

pub fn get_header(&self) -> &Header[src]

Get the header read from this weave file.

pub fn into_header(self) -> Header[src]

Consume the parser, returning the header.

pub fn get_sink(&self) -> Rc<RefCell<S>>[src]

Get a copy of the sink.

Auto Trait Implementations

impl<S, B> Unpin for Parser<S, B> where
    B: Unpin

impl<S, B> !Sync for Parser<S, B>

impl<S, B> !Send for Parser<S, B>

impl<S, B> !UnwindSafe for Parser<S, B>

impl<S, B> !RefUnwindSafe for Parser<S, B>

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]