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

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

Notable traits for TriplesParserIterator<T, E, F, P>

impl<T, E: From<P::Error>, F: FnMut(Triple<'_>) -> Result<T, E>, P: TriplesParser> Iterator for TriplesParserIterator<T, E, F, P> type Item = Result<T, E>;
{ ... } }

A parser returning Triple.

Associated Types

Loading content...

Required methods

pub fn parse_step<E: From<Self::Error>>(
    &mut self,
    on_triple: &mut impl FnMut(Triple<'_>) -> Result<(), E>
) -> Result<(), E>
[src]

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.

pub fn is_end(&self) -> bool[src]

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

Loading content...

Provided methods

pub fn parse_all<E: From<Self::Error>>(
    &mut self,
    on_triple: &mut impl FnMut(Triple<'_>) -> Result<(), E>
) -> Result<(), E>
[src]

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.

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

Notable traits for TriplesParserIterator<T, E, F, P>

impl<T, E: From<P::Error>, F: FnMut(Triple<'_>) -> Result<T, E>, P: TriplesParser> Iterator for TriplesParserIterator<T, E, F, P> type Item = Result<T, E>;
[src]

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

convert_triple is a function converting Rio Triple to T.

Loading content...

Implementors

Loading content...