[−][src]Trait sophia_api::quad::stream::QuadSource
A quad source produces quads, and may also fail in the process.
Any iterator yielding quads wrapped in Result
implements the QuadSource
trait.
Associated Types
type Error: 'static + Error
The type of errors produced by this source.
type Quad: QuadStreamingMode
Determine the type of Quad
s
that this quad source yields.
(see streaming_mode
Required methods
fn try_for_some_quad<F, E>(
&mut self,
f: &mut F
) -> StreamResult<bool, Self::Error, E> where
F: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
&mut self,
f: &mut F
) -> StreamResult<bool, Self::Error, E> where
F: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
Call f for at least one quad from this quad source, if any.
Return false if there are no more quads in this source.
Provided methods
fn try_for_each_quad<F, E>(&mut self, f: F) -> StreamResult<(), Self::Error, E> where
F: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
F: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
Call f for all quads from this quad source.
fn for_some_quad<F>(&mut self, f: &mut F) -> Result<bool, Self::Error> where
F: FnMut(StreamedQuad<Self::Quad>),
F: FnMut(StreamedQuad<Self::Quad>),
Call f for at least one quad from this quad source, if any.
Return false if there are no more quads in this source.
fn for_each_quad<F>(&mut self, f: F) -> Result<(), Self::Error> where
F: FnMut(StreamedQuad<Self::Quad>),
F: FnMut(StreamedQuad<Self::Quad>),
Call f for all quads from this quad source.
fn filter_quads<F>(self, filter: F) -> FilterSource<Self, F> where
Self: Sized,
F: FnMut(&StreamedQuad<Self::Quad>) -> bool,
Self: Sized,
F: FnMut(&StreamedQuad<Self::Quad>) -> bool,
Creates a quad source which uses a closure to determine if a quad should be yielded.
fn filter_map_quads<F, T>(self, filter_map: F) -> FilterMapSource<Self, F> where
Self: Sized,
F: FnMut(StreamedQuad<Self::Quad>) -> Option<T>,
Self: Sized,
F: FnMut(StreamedQuad<Self::Quad>) -> Option<T>,
Creates a quad source that both filters and maps.
fn map_quads<F, T>(self, map: F) -> MapSource<Self, F> where
Self: Sized,
F: FnMut(StreamedQuad<Self::Quad>) -> T,
Self: Sized,
F: FnMut(StreamedQuad<Self::Quad>) -> T,
Takes a closure and creates quad source which yield the result of that closure for each quad.
fn size_hint_quads(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the quad source.
This method has the same contract as Iterator::size_hint
.
fn collect_quads<D>(self) -> StreamResult<D, Self::Error, <D as Dataset>::Error> where
Self: Sized,
D: CollectibleDataset,
Self: Sized,
D: CollectibleDataset,
Collect these quads into a new dataset.
fn add_to_dataset<D: MutableDataset>(
self,
dataset: &mut D
) -> StreamResult<usize, Self::Error, <D as MutableDataset>::MutationError> where
Self: Sized,
self,
dataset: &mut D
) -> StreamResult<usize, Self::Error, <D as MutableDataset>::MutationError> where
Self: Sized,
Insert all quads from this source into the given dataset.
Stop on the first error (in the source or in the dataset).
Implementors
impl<I, T, E> QuadSource for I where
I: Iterator<Item = Result<T, E>>,
T: Quad,
E: 'static + Error,
[src]
I: Iterator<Item = Result<T, E>>,
T: Quad,
E: 'static + Error,
type Error = E
type Quad = ByValue<T>
fn try_for_some_quad<F, EF>(&mut self, f: &mut F) -> StreamResult<bool, E, EF> where
F: FnMut(StreamedQuad<Self::Quad>) -> Result<(), EF>,
EF: Error,
[src]
F: FnMut(StreamedQuad<Self::Quad>) -> Result<(), EF>,
EF: Error,
impl<S, F> QuadSource for FilterSource<S, F> where
S: QuadSource,
F: FnMut(&StreamedQuad<S::Quad>) -> bool,
[src]
S: QuadSource,
F: FnMut(&StreamedQuad<S::Quad>) -> bool,
type Error = S::Error
type Quad = S::Quad
fn try_for_some_quad<G, E>(
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
[src]
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
fn size_hint_quads(&self) -> (usize, Option<usize>)
[src]
impl<S, F, T> QuadSource for sophia_api::quad::stream::FilterMapSource<S, F> where
S: QuadSource,
F: FnMut(StreamedQuad<S::Quad>) -> Option<T>,
T: Quad,
[src]
S: QuadSource,
F: FnMut(StreamedQuad<S::Quad>) -> Option<T>,
T: Quad,
type Error = S::Error
type Quad = ByValue<T>
fn try_for_some_quad<G, E>(
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
[src]
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
fn size_hint_quads(&self) -> (usize, Option<usize>)
[src]
impl<S, F, T> QuadSource for sophia_api::quad::stream::MapSource<S, F> where
S: QuadSource,
F: FnMut(StreamedQuad<S::Quad>) -> T,
T: Quad,
[src]
S: QuadSource,
F: FnMut(StreamedQuad<S::Quad>) -> T,
T: Quad,
type Error = S::Error
type Quad = ByValue<T>
fn try_for_some_quad<G, E>(
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
[src]
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
fn size_hint_quads(&self) -> (usize, Option<usize>)
[src]
impl<S, F, T> QuadSource for sophia_api::triple::stream::FilterMapSource<S, F> where
S: TripleSource,
F: FnMut(StreamedTriple<S::Triple>) -> Option<T>,
T: Quad,
[src]
S: TripleSource,
F: FnMut(StreamedTriple<S::Triple>) -> Option<T>,
T: Quad,
type Error = S::Error
type Quad = ByValue<T>
fn try_for_some_quad<G, E>(
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
[src]
&mut self,
f: &mut G
) -> StreamResult<bool, Self::Error, E> where
G: FnMut(StreamedQuad<Self::Quad>) -> Result<(), E>,
E: Error,
fn size_hint_quads(&self) -> (usize, Option<usize>)
[src]
impl<S, F, T> QuadSource for sophia_api::triple::stream::MapSource<S, F> where
S: TripleSource,
F: FnMut(StreamedTriple<S::Triple>) -> T,
T: Quad,
[src]
S: TripleSource,
F: FnMut(StreamedTriple<S::Triple>) -> T,
T: Quad,