Trait rio_api::parser::GeneralizedQuadsParser
source ·
[−]pub trait GeneralizedQuadsParser {
type Error: Error;
fn parse_step<E: From<Self::Error>>(
&mut self,
on_quad: &mut impl FnMut(GeneralizedQuad<'_>) -> Result<(), E>
) -> Result<(), E>;
fn is_end(&self) -> bool;
fn parse_all<E: From<Self::Error>>(
&mut self,
on_quad: &mut impl FnMut(GeneralizedQuad<'_>) -> Result<(), E>
) -> Result<(), E> { ... }
fn into_iter<T, E, F>(
self,
convert_quad: F
) -> GeneralizedQuadsParserIterator<T, E, F, Self>ⓘNotable traits for GeneralizedQuadsParserIterator<T, E, F, P>impl<T, E, F, P> Iterator for GeneralizedQuadsParserIterator<T, E, F, P> where
E: From<P::Error>,
F: FnMut(GeneralizedQuad<'_>) -> Result<T, E>,
P: GeneralizedQuadsParser + Sized, type Item = Result<T, E>;
where
E: From<Self::Error>,
F: FnMut(GeneralizedQuad<'_>) -> Result<T, E>,
Self: Sized,
{ ... }
}
Expand description
A parser returning generalized Quad
.
Using it requires to enable the generalized
feature.
Associated Types
Required methods
fn parse_step<E: From<Self::Error>>(
&mut self,
on_quad: &mut impl FnMut(GeneralizedQuad<'_>) -> Result<(), E>
) -> Result<(), E>
fn parse_step<E: From<Self::Error>>(
&mut self,
on_quad: &mut impl FnMut(GeneralizedQuad<'_>) -> Result<(), E>
) -> Result<(), E>
Parses a small chunk of the file and calls on_quad
each time a new quad is read.
(A “small chunk” could be a line for an N-Quads parser.)
This method should be called as long as is_end
returns false.
May fails on errors caused by the parser itself or by the callback function on_quad
.
Provided methods
Parses the complete file and calls on_quad
each time a new quad is read.
May fails on errors caused by the parser itself or by the callback function on_quad
.
fn into_iter<T, E, F>(
self,
convert_quad: F
) -> GeneralizedQuadsParserIterator<T, E, F, Self>ⓘNotable traits for GeneralizedQuadsParserIterator<T, E, F, P>impl<T, E, F, P> Iterator for GeneralizedQuadsParserIterator<T, E, F, P> where
E: From<P::Error>,
F: FnMut(GeneralizedQuad<'_>) -> Result<T, E>,
P: GeneralizedQuadsParser + Sized, type Item = Result<T, E>;
where
E: From<Self::Error>,
F: FnMut(GeneralizedQuad<'_>) -> Result<T, E>,
Self: Sized,
fn into_iter<T, E, F>(
self,
convert_quad: F
) -> GeneralizedQuadsParserIterator<T, E, F, Self>ⓘNotable traits for GeneralizedQuadsParserIterator<T, E, F, P>impl<T, E, F, P> Iterator for GeneralizedQuadsParserIterator<T, E, F, P> where
E: From<P::Error>,
F: FnMut(GeneralizedQuad<'_>) -> Result<T, E>,
P: GeneralizedQuadsParser + Sized, type Item = Result<T, E>;
where
E: From<Self::Error>,
F: FnMut(GeneralizedQuad<'_>) -> Result<T, E>,
Self: Sized,
Notable traits for GeneralizedQuadsParserIterator<T, E, F, P>
impl<T, E, F, P> Iterator for GeneralizedQuadsParserIterator<T, E, F, P> where
E: From<P::Error>,
F: FnMut(GeneralizedQuad<'_>) -> Result<T, E>,
P: GeneralizedQuadsParser + Sized, type Item = Result<T, E>;
Converts the parser into a Result<T, E>
iterator.
convert_quad
is a function converting Rio GeneralizedQuad
s to T
.