[][src]Trait rio_api::parser::TriplesParser

pub trait TriplesParser: Sized {
    type Error: Error;
    fn parse_step<E: From<Self::Error>>(
        &mut self,
        on_triple: &mut impl FnMut(Triple) -> Result<(), E>
    ) -> Result<(), E>;
fn is_end(&self) -> bool; fn parse_all<E: From<Self::Error>>(
        &mut self,
        on_triple: &mut impl FnMut(Triple) -> Result<(), E>
    ) -> Result<(), E> { ... }
fn into_iter<T, E: From<Self::Error>, F: FnMut(Triple) -> Result<T, E>>(
        self,
        convert_triple: F
    ) -> TriplesParserIterator<T, E, F, Self> { ... } }

A parser returning Triple.

Associated Types

type Error: Error

Loading content...

Required methods

fn parse_step<E: From<Self::Error>>(
    &mut self,
    on_triple: &mut impl FnMut(Triple) -> Result<(), E>
) -> Result<(), E>

Parses a small chunk of the file and calls on_triple each time a new triple is read. (A "small chunk" could be a line for an N-Triples parser.)

This method should be called as long as is_end returns false.

It may fail on errors caused by the parser itself or by the callback function on_triple.

fn is_end(&self) -> bool

Returns true if the file has been completely consumed by the parser.

Loading content...

Provided methods

fn parse_all<E: From<Self::Error>>(
    &mut self,
    on_triple: &mut impl FnMut(Triple) -> Result<(), E>
) -> Result<(), E>

Parses the complete file and calls on_triple each time a new triple is read.

May fail on errors caused by the parser itself or by the callback function on_triple.

fn into_iter<T, E: From<Self::Error>, F: FnMut(Triple) -> Result<T, E>>(
    self,
    convert_triple: F
) -> TriplesParserIterator<T, E, F, Self>

Converts the parser into a Result<T, E> iterator.

convert_triple is a function converting Rio Triple to T.

Loading content...

Implementors

Loading content...