pub trait QuadSource: Source + IsQuadSource {
// Provided methods
fn try_for_some_quad<E, F>(
&mut self,
f: F,
) -> StreamResult<bool, Self::Error, E>
where E: Error + Send + Sync + 'static,
F: FnMut(Self::Quad<'_>) -> Result<(), E> { ... }
fn try_for_each_quad<F, E>(
&mut self,
f: F,
) -> StreamResult<(), Self::Error, E>
where F: FnMut(Self::Quad<'_>) -> Result<(), E>,
E: Error + Send + Sync + 'static { ... }
fn for_some_quad<F>(&mut self, f: F) -> Result<bool, Self::Error>
where F: FnMut(Self::Quad<'_>) { ... }
fn for_each_quad<F>(&mut self, f: F) -> Result<(), Self::Error>
where F: FnMut(Self::Quad<'_>) { ... }
fn filter_quads<'f, F>(
self,
predicate: F,
) -> FilterQuadSource<Self, impl FnMut(&Self::Item<'_>) -> bool + 'f>
where Self: Sized,
F: FnMut(&QSQuad<'_, Self>) -> bool + 'f { ... }
fn filter_map_quads<'f, F, T>(
self,
filter_map: F,
) -> FilterMapSource<Self, impl FnMut(Self::Item<'_>) -> Option<T> + 'f>
where Self: Sized,
F: FnMut(Self::Quad<'_>) -> Option<T> + 'f { ... }
fn map_quads<'f, F, T>(
self,
map: F,
) -> MapSource<Self, impl FnMut(Self::Item<'_>) -> T + 'f>
where Self: Sized,
F: FnMut(Self::Quad<'_>) -> T + 'f { ... }
fn to_triples(self) -> ToTriples<Self>
where Self: Sized { ... }
fn size_hint_quads(&self) -> (usize, Option<usize>) { ... }
fn collect_quads<D>(
self,
) -> StreamResult<D, Self::Error, <D as Dataset>::Error>
where Self: Sized,
for<'x> Self::Quad<'x>: Quad,
D: CollectibleDataset { ... }
fn add_to_dataset<D: MutableDataset>(
self,
dataset: &mut D,
) -> StreamResult<usize, Self::Error, <D as MutableDataset>::MutationError>
where Self: Sized,
for<'x> Self::Quad<'x>: Quad { ... }
}Expand description
Provided Methods§
Sourcefn try_for_some_quad<E, F>(
&mut self,
f: F,
) -> StreamResult<bool, Self::Error, E>
fn try_for_some_quad<E, F>( &mut self, f: F, ) -> StreamResult<bool, Self::Error, E>
Call f for some quad(s) (possibly zero) from this source, if any.
Return Ok(false) if there are no more quads in this source.
Return an error if either the source or f errs.
Sourcefn try_for_each_quad<F, E>(&mut self, f: F) -> StreamResult<(), Self::Error, E>
fn try_for_each_quad<F, E>(&mut self, f: F) -> StreamResult<(), Self::Error, E>
Call f for all quads from this source.
Return an error if either the source or f errs.
Sourcefn for_some_quad<F>(&mut self, f: F) -> Result<bool, Self::Error>where
F: FnMut(Self::Quad<'_>),
fn for_some_quad<F>(&mut self, f: F) -> Result<bool, Self::Error>where
F: FnMut(Self::Quad<'_>),
Call f for some quad(s) (possibly zero) from this source, if any.
Return false if there are no more quads in this source.
Return an error if either the source errs.
Sourcefn for_each_quad<F>(&mut self, f: F) -> Result<(), Self::Error>where
F: FnMut(Self::Quad<'_>),
fn for_each_quad<F>(&mut self, f: F) -> Result<(), Self::Error>where
F: FnMut(Self::Quad<'_>),
Call f for all quads from this source.
Return an error if either the source errs.
Sourcefn filter_quads<'f, F>(
self,
predicate: F,
) -> FilterQuadSource<Self, impl FnMut(&Self::Item<'_>) -> bool + 'f>
fn filter_quads<'f, F>( self, predicate: F, ) -> FilterQuadSource<Self, impl FnMut(&Self::Item<'_>) -> bool + 'f>
Returns a source which uses predicate to determine if an quad should be yielded.
Sourcefn filter_map_quads<'f, F, T>(
self,
filter_map: F,
) -> FilterMapSource<Self, impl FnMut(Self::Item<'_>) -> Option<T> + 'f>
fn filter_map_quads<'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 QuadSource::filter_quads and QuadSource::map_quads.
Sourcefn map_quads<'f, F, T>(
self,
map: F,
) -> MapSource<Self, impl FnMut(Self::Item<'_>) -> T + 'f>
fn map_quads<'f, F, T>( self, map: F, ) -> MapSource<Self, impl FnMut(Self::Item<'_>) -> T + 'f>
Returns a source which yield the result of map for each quad.
See also QuadSource::to_triples.
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 |q| q or |q| q.to_spog()
currently do not compile on all implementations of QuadSource.
Furthermore, some functions returning a Quad are accepted,
but fail to make the resulting map::MapSource recognized as a QuadSource.
As a rule of thumb,
whenever map returns something satisfying the 'static lifetime,
things should work as expected.
Sourcefn to_triples(self) -> ToTriples<Self>where
Self: Sized,
fn to_triples(self) -> ToTriples<Self>where
Self: Sized,
Convert of quads in this source to triples (stripping the graph name).
Sourcefn size_hint_quads(&self) -> (usize, Option<usize>)
fn size_hint_quads(&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 collect_quads<D>(self) -> StreamResult<D, Self::Error, <D as Dataset>::Error>
fn collect_quads<D>(self) -> StreamResult<D, Self::Error, <D as Dataset>::Error>
Collect these quads into a new dataset.
Sourcefn add_to_dataset<D: MutableDataset>(
self,
dataset: &mut D,
) -> StreamResult<usize, Self::Error, <D as MutableDataset>::MutationError>
fn add_to_dataset<D: MutableDataset>( self, dataset: &mut D, ) -> StreamResult<usize, Self::Error, <D as MutableDataset>::MutationError>
Insert all quads from this source into the given MutableDataset.
Stop on the first error (in the source or in the dataset).
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> QuadSource for Twhere
T: Source + IsQuadSource,
Ensures that QuadSource acts as an type alias for any Source satisfying the conditions.