Trait sophia_api::triple::stream::TripleSource
source · [−]pub trait TripleSource {
type Error: 'static + Error;
type Triple: TripleStreamingMode;
fn try_for_some_triple<F, E>(
&mut self,
f: &mut F
) -> StreamResult<bool, Self::Error, E>
where
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Result<(), E>,
E: Error;
fn try_for_each_triple<F, E>(
&mut self,
f: F
) -> StreamResult<(), Self::Error, E>
where
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Result<(), E>,
E: Error,
{ ... }
fn for_some_triple<F>(&mut self, f: &mut F) -> Result<bool, Self::Error>
where
F: FnMut(StreamedTriple<'_, Self::Triple>),
{ ... }
fn for_each_triple<F>(&mut self, f: F) -> Result<(), Self::Error>
where
F: FnMut(StreamedTriple<'_, Self::Triple>),
{ ... }
fn filter_triples<F>(self, filter: F) -> FilterSource<Self, F>
where
Self: Sized,
F: FnMut(&StreamedTriple<'_, Self::Triple>) -> bool,
{ ... }
fn filter_map_triples<F, T>(self, filter_map: F) -> FilterMapSource<Self, F>
where
Self: Sized,
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Option<T>,
{ ... }
fn map_triples<F, T>(self, map: F) -> MapSource<Self, F>
where
Self: Sized,
F: FnMut(StreamedTriple<'_, Self::Triple>) -> T,
{ ... }
fn size_hint_triples(&self) -> (usize, Option<usize>) { ... }
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
Associated Types
Determine the type of Triple
s
that this triple source yields.
(see streaming_mode
)
Required methods
fn try_for_some_triple<F, E>(
&mut self,
f: &mut F
) -> StreamResult<bool, Self::Error, E> where
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Result<(), E>,
E: Error,
fn try_for_some_triple<F, E>(
&mut self,
f: &mut F
) -> StreamResult<bool, Self::Error, E> where
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Result<(), E>,
E: Error,
Call f for at least one triple from this triple source, if any.
Return false if there are no more triples in this source.
Provided methods
fn try_for_each_triple<F, E>(
&mut self,
f: F
) -> StreamResult<(), Self::Error, E> where
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Result<(), E>,
E: Error,
fn try_for_each_triple<F, E>(
&mut self,
f: F
) -> StreamResult<(), Self::Error, E> where
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Result<(), E>,
E: Error,
Call f for all triples from this triple source.
fn for_some_triple<F>(&mut self, f: &mut F) -> Result<bool, Self::Error> where
F: FnMut(StreamedTriple<'_, Self::Triple>),
fn for_some_triple<F>(&mut self, f: &mut F) -> Result<bool, Self::Error> where
F: FnMut(StreamedTriple<'_, Self::Triple>),
Call f for at least one triple from this triple source, if any.
Return false if there are no more triples in this source.
fn for_each_triple<F>(&mut self, f: F) -> Result<(), Self::Error> where
F: FnMut(StreamedTriple<'_, Self::Triple>),
fn for_each_triple<F>(&mut self, f: F) -> Result<(), Self::Error> where
F: FnMut(StreamedTriple<'_, Self::Triple>),
Call f for all triples from this triple source.
fn filter_triples<F>(self, filter: F) -> FilterSource<Self, F> where
Self: Sized,
F: FnMut(&StreamedTriple<'_, Self::Triple>) -> bool,
fn filter_triples<F>(self, filter: F) -> FilterSource<Self, F> where
Self: Sized,
F: FnMut(&StreamedTriple<'_, Self::Triple>) -> bool,
Creates a triple source which uses a closure to determine if a triple should be yielded.
fn filter_map_triples<F, T>(self, filter_map: F) -> FilterMapSource<Self, F> where
Self: Sized,
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Option<T>,
fn filter_map_triples<F, T>(self, filter_map: F) -> FilterMapSource<Self, F> where
Self: Sized,
F: FnMut(StreamedTriple<'_, Self::Triple>) -> Option<T>,
Creates a triple source that both filters and maps.
fn map_triples<F, T>(self, map: F) -> MapSource<Self, F> where
Self: Sized,
F: FnMut(StreamedTriple<'_, Self::Triple>) -> T,
fn map_triples<F, T>(self, map: F) -> MapSource<Self, F> where
Self: Sized,
F: FnMut(StreamedTriple<'_, Self::Triple>) -> T,
Takes a closure and creates triple source which yield the result of that closure for each triple.
Returns the bounds on the remaining length of the triple source.
This method has the same contract as Iterator::size_hint
.
fn 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.
fn 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).