1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use std::convert::Infallible;
use std::iter::Map;
use super::*;
impl<I, T, E> TripleSource for I
where
I: Iterator<Item = Result<T, E>>,
T: Triple,
E: 'static + Error,
{
type Error = E;
type Triple = ByValue<T>;
fn try_for_some_triple<F, EF>(&mut self, f: &mut F) -> StreamResult<bool, E, EF>
where
F: FnMut(StreamedTriple<Self::Triple>) -> Result<(), EF>,
EF: Error,
{
match self.next() {
Some(Ok(triple)) => f(StreamedTriple::by_value(triple))
.map_err(SinkError)
.and(Ok(true)),
Some(Err(err)) => Err(SourceError(err)),
None => Ok(false),
}
}
fn size_hint_triples(&self) -> (usize, Option<usize>) {
self.size_hint()
}
}
pub type IntoInfallibleSource<I, T> = Map<I, fn(T) -> Result<T, Infallible>>;
#[deprecated(since = "0.6.3", note = "has been renamed to IntoInfallibleSource")]
pub use IntoInfallibleSource as AsInfallibleSource;
pub trait IntoTripleSource<T>: Sized {
fn into_triple_source(self) -> IntoInfallibleSource<Self, T>;
#[deprecated(since = "0.6.3", note = "has been renamed to into_triple_source")]
#[allow(clippy::wrong_self_convention)]
fn as_triple_source(self) -> IntoInfallibleSource<Self, T> {
self.into_triple_source()
}
}
#[deprecated(since = "0.6.3", note = "has been renamed to IntoTripleSource")]
pub use self::IntoTripleSource as AsTripleSource;
impl<T, I> IntoTripleSource<T> for I
where
I: Iterator<Item = T> + Sized,
T: Triple,
{
fn into_triple_source(self) -> IntoInfallibleSource<Self, T> {
self.map(Ok)
}
}