Struct weave::Parser
[−]
[src]
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<Read>>>
[src]
fn new(
naming: &NamingConvention,
sink: S,
delta: usize
) -> Result<Parser<S, BufReader<Box<Read>>>>
naming: &NamingConvention,
sink: S,
delta: usize
) -> Result<Parser<S, BufReader<Box<Read>>>>
Construct a parser, based on the main file of the naming convention.
impl<S: Sink, B: BufRead> Parser<S, B>
[src]
fn new_raw(
source: Lines<B>,
sink: Rc<RefCell<S>>,
delta: usize
) -> Result<Parser<S, B>>
source: Lines<B>,
sink: Rc<RefCell<S>>,
delta: usize
) -> Result<Parser<S, B>>
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).
fn parse_to(&mut self, lineno: usize) -> Result<usize>
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.
fn get_header(&self) -> &Header
Get the header read from this weave file.
fn into_header(self) -> Header
Consume the parser, returning the header.
fn get_sink(&self) -> Rc<RefCell<S>>
Get a copy of the sink.