pub trait TripleSource: Source + IsTripleSource {
// Provided methods
fn try_for_some_triple<E, F>(
&mut self,
f: F,
) -> StreamResult<bool, Self::Error, E>
where E: Error + Send + Sync + 'static,
F: FnMut(TSTriple<'_, Self>) -> Result<(), E> { ... }
fn try_for_each_triple<F, E>(
&mut self,
f: F,
) -> StreamResult<(), Self::Error, E>
where F: FnMut(TSTriple<'_, Self>) -> Result<(), E>,
E: Error + Send + Sync + 'static { ... }
fn for_some_triple<F>(&mut self, f: F) -> Result<bool, Self::Error>
where F: FnMut(TSTriple<'_, Self>) { ... }
fn for_each_triple<F>(&mut self, f: F) -> Result<(), Self::Error>
where F: FnMut(TSTriple<'_, Self>) { ... }
fn filter_triples<'f, F>(
self,
predicate: F,
) -> FilterTripleSource<Self, impl FnMut(&Self::Item<'_>) -> bool + 'f>
where Self: Sized,
F: FnMut(&TSTriple<'_, Self>) -> bool + 'f { ... }
fn filter_map_triples<'f, F, T>(
self,
filter_map: F,
) -> FilterMapSource<Self, impl FnMut(Self::Item<'_>) -> Option<T> + 'f>
where Self: Sized,
F: FnMut(TSTriple<'_, Self>) -> Option<T> + 'f { ... }
fn map_triples<'m, F, T>(
self,
map: F,
) -> MapSource<Self, impl FnMut(Self::Item<'_>) -> T + 'm>
where Self: Sized,
F: FnMut(TSTriple<'_, Self>) -> T + 'm { ... }
fn size_hint_triples(&self) -> (usize, Option<usize>) { ... }
fn to_quads(self) -> ToQuads<Self>
where Self: Sized { ... }
fn collect_triples<G>(
self,
) -> StreamResult<G, Self::Error, <G as Graph>::Error>
where Self: Sized,
G: CollectibleGraph { ... }
fn add_to_graph<G: MutableGraph>(
self,
graph: &mut G,
) -> StreamResult<usize, Self::Error, <G as MutableGraph>::MutationError>
where Self: Sized { ... }
}Expand description
Provided Methods§
Sourcefn try_for_some_triple<E, F>(
&mut self,
f: F,
) -> StreamResult<bool, Self::Error, E>
fn try_for_some_triple<E, F>( &mut self, f: F, ) -> StreamResult<bool, Self::Error, E>
Call f for some triple(s) (possibly zero) from this source, if any.
Return Ok(false) if there are no more triples in this source.
Return an error if either the source or f errs.
Sourcefn try_for_each_triple<F, E>(
&mut self,
f: F,
) -> StreamResult<(), Self::Error, E>
fn try_for_each_triple<F, E>( &mut self, f: F, ) -> StreamResult<(), Self::Error, E>
Call f for all triples from this source.
Return an error if either the source or f errs.
Sourcefn for_some_triple<F>(&mut self, f: F) -> Result<bool, Self::Error>
fn for_some_triple<F>(&mut self, f: F) -> Result<bool, Self::Error>
Call f for some triple(s) (possibly zero) from this source, if any.
Return false if there are no more triples in this source.
Return an error if either the source errs.
Sourcefn for_each_triple<F>(&mut self, f: F) -> Result<(), Self::Error>
fn for_each_triple<F>(&mut self, f: F) -> Result<(), Self::Error>
Call f for all triples from this source.
Return an error if either the source errs.
Sourcefn filter_triples<'f, F>(
self,
predicate: F,
) -> FilterTripleSource<Self, impl FnMut(&Self::Item<'_>) -> bool + 'f>
fn filter_triples<'f, F>( self, predicate: F, ) -> FilterTripleSource<Self, impl FnMut(&Self::Item<'_>) -> bool + 'f>
Returns a source which uses predicate to determine if an triple should be yielded.
Sourcefn filter_map_triples<'f, F, T>(
self,
filter_map: F,
) -> FilterMapSource<Self, impl FnMut(Self::Item<'_>) -> Option<T> + 'f>
fn filter_map_triples<'f, F, T>( self, filter_map: F, ) -> FilterMapSource<Self, impl FnMut(Self::Item<'_>) -> Option<T> + 'f>
Returns a source that both filters and maps.
See also TripleSource::filter_triples and TripleSource::map_triples.
Sourcefn map_triples<'m, F, T>(
self,
map: F,
) -> MapSource<Self, impl FnMut(Self::Item<'_>) -> T + 'm>
fn map_triples<'m, F, T>( self, map: F, ) -> MapSource<Self, impl FnMut(Self::Item<'_>) -> T + 'm>
Returns a source which yield the result of map for each triple.
See also TripleSource::to_quads.
NB: due to some limitations in GATs (Generic) Associated Types,
the map function is currently restricted in what it can return.
In particular, passing functions as trivial as |t| t or |t| t.to_spo()
currently do not compile on all implementations of TripleSource.
Furthermore, some functions returning a Triple are accepted,
but fail to make the resulting map::MapSource recognized as a TripleSource.
As a rule of thumb,
whenever map returns something satisfying the 'static lifetime,
things should work as expected.
Sourcefn size_hint_triples(&self) -> (usize, Option<usize>)
fn size_hint_triples(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the source.
This method has the same contract as Iterator::size_hint.
Sourcefn to_quads(self) -> ToQuads<Self>where
Self: Sized,
fn to_quads(self) -> ToQuads<Self>where
Self: Sized,
Convert of triples in this source to quads (belonging to the default graph).
Sourcefn collect_triples<G>(self) -> StreamResult<G, Self::Error, <G as Graph>::Error>where
Self: Sized,
G: CollectibleGraph,
fn collect_triples<G>(self) -> StreamResult<G, Self::Error, <G as Graph>::Error>where
Self: Sized,
G: CollectibleGraph,
Collect these triples into a new graph.
Sourcefn add_to_graph<G: MutableGraph>(
self,
graph: &mut G,
) -> StreamResult<usize, Self::Error, <G as MutableGraph>::MutationError>where
Self: Sized,
fn add_to_graph<G: MutableGraph>(
self,
graph: &mut G,
) -> StreamResult<usize, Self::Error, <G as MutableGraph>::MutationError>where
Self: Sized,
Insert all triples from this source into the given MutableGraph.
Stop on the first error (in the source or in the graph).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<T> TripleSource for Twhere
T: Source + IsTripleSource,
Ensures that TripleSource acts as an type alias for any Source satisfying the conditions.