Skip to main content

FallibleLender

Trait FallibleLender 

Source
pub trait FallibleLender: for<'all> FallibleLending<'all> {
    type Error;

Show 81 methods // Required methods fn __check_covariance<'long: 'short, 'short>( proof: CovariantProof<&'short <Self as FallibleLending<'long>>::Lend>, ) -> CovariantProof<&'short <Self as FallibleLending<'short>>::Lend>; fn next(&mut self) -> Result<Option<FallibleLend<'_, Self>>, Self::Error>; // Provided methods fn next_chunk(&mut self, chunk_size: usize) -> Chunk<'_, Self> where Self: Sized { ... } fn size_hint(&self) -> (usize, Option<usize>) { ... } fn count(self) -> Result<usize, Self::Error> where Self: Sized { ... } fn last<'call>( &'call mut self, ) -> Result<Option<FallibleLend<'call, Self>>, Self::Error> where Self: Sized { ... } fn advance_by( &mut self, n: usize, ) -> Result<Result<(), NonZeroUsize>, Self::Error> { ... } fn nth( &mut self, n: usize, ) -> Result<Option<FallibleLend<'_, Self>>, Self::Error> { ... } fn step_by(self, step: usize) -> StepBy<Self> where Self: Sized { ... } fn chain<U>( self, other: U, ) -> Chain<Self, <U as IntoFallibleLender>::FallibleLender> where Self: Sized, U: IntoFallibleLender<Error = Self::Error> + for<'all> FallibleLending<'all, Lend = FallibleLend<'all, Self>> { ... } fn zip<U: IntoFallibleLender>( self, other: U, ) -> Zip<Self, <U as IntoFallibleLender>::FallibleLender> where Self: Sized { ... } fn intersperse<'call>( self, separator: FallibleLend<'call, Self>, ) -> FallibleIntersperse<'call, Self> where Self: Sized, for<'all> FallibleLend<'all, Self>: Clone { ... } fn intersperse_with<'call, G>( self, separator: G, ) -> FallibleIntersperseWith<'call, Self, G> where Self: Sized, G: FnMut() -> Result<FallibleLend<'call, Self>, Self::Error> { ... } fn map<F>(self, f: Covar<F>) -> Map<Self, F> where Self: Sized, F: for<'all> FnMutHKARes<'all, FallibleLend<'all, Self>, Self::Error> { ... } fn map_err<E, F>(self, f: F) -> MapErr<E, Self, F> where Self: Sized, F: FnMut(Self::Error) -> E { ... } fn map_into_iter<O, F>(self, f: F) -> MapIntoIter<Self, O, F> where Self: Sized, F: FnMut(FallibleLend<'_, Self>) -> Result<O, Self::Error> { ... } fn for_each<F>(self, f: F) -> Result<(), Self::Error> where Self: Sized, F: FnMut(FallibleLend<'_, Self>) -> Result<(), Self::Error> { ... } fn filter<P>(self, predicate: P) -> Filter<Self, P> where Self: Sized, P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn filter_map<F>(self, f: Covar<F>) -> FilterMap<Self, F> where Self: Sized, F: for<'all> FnMutHKAResOpt<'all, FallibleLend<'all, Self>, Self::Error> { ... } fn enumerate(self) -> Enumerate<Self> where Self: Sized { ... } fn peekable<'call>(self) -> FalliblePeekable<'call, Self> where Self: Sized { ... } fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where Self: Sized, P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where Self: Sized, P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn map_while<P>(self, predicate: Covar<P>) -> MapWhile<Self, P> where Self: Sized, P: for<'all> FnMutHKAResOpt<'all, FallibleLend<'all, Self>, Self::Error> { ... } fn skip(self, n: usize) -> Skip<Self> where Self: Sized { ... } fn take(self, n: usize) -> Take<Self> where Self: Sized { ... } fn scan<St, F>(self, initial_state: St, f: Covar<F>) -> Scan<Self, St, F> where Self: Sized, F: for<'all> FnMutHKAResOpt<'all, (&'all mut St, FallibleLend<'all, Self>), Self::Error> { ... } fn flat_map<'call, F>(self, f: Covar<F>) -> FallibleFlatMap<'call, Self, F> where Self: Sized, F: for<'all> FnMutHKARes<'all, FallibleLend<'all, Self>, Self::Error>, for<'all> <F as FnMutHKARes<'all, FallibleLend<'all, Self>, Self::Error>>::B: IntoFallibleLender<Error = Self::Error> { ... } fn flatten<'call>(self) -> FallibleFlatten<'call, Self> where Self: Sized, for<'all> FallibleLend<'all, Self>: IntoFallibleLender<Error = Self::Error> { ... } fn fuse(self) -> Fuse<Self> where Self: Sized { ... } fn inspect<F>(self, f: F) -> Inspect<Self, F> where Self: Sized, F: FnMut(&FallibleLend<'_, Self>) -> Result<(), Self::Error> { ... } fn mutate<F>(self, f: F) -> Mutate<Self, F> where Self: Sized, F: FnMut(&mut FallibleLend<'_, Self>) -> Result<(), Self::Error> { ... } fn by_ref(&mut self) -> &mut Self where Self: Sized { ... } fn collect<B>(self) -> Result<B, (B, Self::Error)> where Self: Sized, for<'all> B: FromLender<NonFallibleAdapter<'all, Self>> { ... } fn try_collect<'a, B, T>(&'a mut self) -> Result<T, (T, Self::Error)> where Self: Sized, for<'all> FallibleLend<'all, Self>: Try, for<'all> <FallibleLend<'all, Self> as Try>::Residual: Residual<B, TryType = T>, for<'b, 'c, 'd> B: FromLender<FallibleTryShuntAdapter<'b, 'c, 'd, 'a, Self>> { ... } fn collect_into<E>( self, collection: &mut E, ) -> Result<&mut E, (&mut E, Self::Error)> where Self: Sized, for<'all> E: ExtendLender<NonFallibleAdapter<'all, Self>> { ... } fn partition<'this, E, F>( self, f: F, ) -> Result<(E, E), ((E, E), Self::Error)> where Self: Sized + 'this, E: Default + ExtendLender<NonFallibleAdapter<'this, Self>>, F: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn is_partitioned<P>(self, predicate: P) -> Result<bool, Self::Error> where Self: Sized, P: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Result<R, Self::Error> where F: FnMut(B, FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = B> { ... } fn try_for_each<F, R>(&mut self, f: F) -> Result<R, Self::Error> where F: FnMut(FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = ()> { ... } fn fold<B, F>(self, init: B, f: F) -> Result<B, Self::Error> where Self: Sized, F: FnMut(B, FallibleLend<'_, Self>) -> Result<B, Self::Error> { ... } fn reduce<T, F>(self, f: F) -> Result<Option<T>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(T, FallibleLend<'_, Self>) -> Result<T, Self::Error> { ... } fn try_reduce<T, F, R>( self, f: F, ) -> Result<ChangeOutputType<R, Option<T>>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(T, FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = T>, R::Residual: Residual<Option<T>> { ... } fn all<F>(&mut self, f: F) -> Result<bool, Self::Error> where F: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn any<F>(&mut self, f: F) -> Result<bool, Self::Error> where F: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn find<P>( &mut self, predicate: P, ) -> Result<Option<FallibleLend<'_, Self>>, Self::Error> where P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn find_map<'a, F>( &'a mut self, f: F, ) -> Result<Option<<F as FnMutHKAResOpt<'a, FallibleLend<'a, Self>, Self::Error>>::B>, Self::Error> where Self: Sized, F: for<'all> FnMutHKAResOpt<'all, FallibleLend<'all, Self>, Self::Error> { ... } fn try_find<F, R>( &mut self, f: F, ) -> Result<ChangeOutputType<R, Option<FallibleLend<'_, Self>>>, Self::Error> where Self: Sized, F: FnMut(&FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = bool>, for<'all> R::Residual: Residual<Option<FallibleLend<'all, Self>>> { ... } fn position<P>( &mut self, predicate: P, ) -> Result<Option<usize>, Self::Error> where Self: Sized, P: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error> { ... } fn rposition<P>( &mut self, predicate: P, ) -> Result<Option<usize>, Self::Error> where P: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error>, Self: Sized + ExactSizeFallibleLender + DoubleEndedFallibleLender { ... } fn max<T: Ord>(self) -> Result<Option<T>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T> { ... } fn min<T: Ord>(self) -> Result<Option<T>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T> { ... } fn max_by_key<B: Ord, T, F>(self, f: F) -> Result<Option<T>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T) -> Result<B, Self::Error> { ... } fn max_by<T, F>(self, compare: F) -> Result<Option<T>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T, &FallibleLend<'_, Self>) -> Result<Ordering, Self::Error> { ... } fn min_by_key<B: Ord, T, F>(self, f: F) -> Result<Option<T>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T) -> Result<B, Self::Error> { ... } fn min_by<T, F>(self, compare: F) -> Result<Option<T>, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T, &FallibleLend<'_, Self>) -> Result<Ordering, Self::Error> { ... } fn rev(self) -> Rev<Self> where Self: Sized + DoubleEndedFallibleLender { ... } fn unzip<ExtA, ExtB>(self) -> Result<(ExtA, ExtB), Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: TupleLend<'all>, ExtA: Default + for<'this> ExtendLender<NonFallibleAdapter<'this, <FirstShunt<Self> as IntoFallibleLender>::FallibleLender>>, ExtB: Default + for<'this> ExtendLender<NonFallibleAdapter<'this, <SecondShunt<Self> as IntoFallibleLender>::FallibleLender>> { ... } fn copied<T>(self) -> Copied<Self> where Self: Sized + for<'all> FallibleLending<'all, Lend = &'all T>, T: Copy { ... } fn cloned<T>(self) -> Cloned<Self> where Self: Sized + for<'all> FallibleLending<'all, Lend = &'all T>, T: Clone { ... } fn owned(self) -> Owned<Self> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned { ... } fn cycle(self) -> Cycle<Self> where Self: Sized + Clone { ... } fn sum<S>(self) -> Result<S, Self::Error> where Self: Sized, S: SumFallibleLender<Self> { ... } fn product<P>(self) -> Result<P, Self::Error> where Self: Sized, P: ProductFallibleLender<Self> { ... } fn cmp<L>(self, other: L) -> Result<Ordering, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, L::FallibleLender: for<'all> FallibleLending<'all, Lend = FallibleLend<'all, Self>>, for<'all> FallibleLend<'all, Self>: Ord, Self: Sized { ... } fn cmp_by<L, F>(self, other: L, cmp: F) -> Result<Ordering, Self::Error> where Self: Sized, L: IntoFallibleLender<Error = Self::Error>, F: for<'all> FnMut(FallibleLend<'all, Self>, FallibleLend<'all, L::FallibleLender>) -> Result<Ordering, Self::Error> { ... } fn partial_cmp<L>(self, other: L) -> Result<Option<Ordering>, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized { ... } fn partial_cmp_by<L, F>( self, other: L, partial_cmp: F, ) -> Result<Option<Ordering>, Self::Error> where Self: Sized, L: IntoFallibleLender<Error = Self::Error>, F: for<'all> FnMut(FallibleLend<'all, Self>, FallibleLend<'all, L::FallibleLender>) -> Result<Option<Ordering>, Self::Error> { ... } fn eq<L>(self, other: L) -> Result<bool, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialEq<FallibleLend<'all, L::FallibleLender>>, Self: Sized { ... } fn eq_by<L, F>(self, other: L, eq: F) -> Result<bool, Self::Error> where Self: Sized, L: IntoFallibleLender<Error = Self::Error>, F: for<'all> FnMut(FallibleLend<'all, Self>, FallibleLend<'all, L::FallibleLender>) -> Result<bool, Self::Error> { ... } fn ne<L>(self, other: L) -> Result<bool, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialEq<FallibleLend<'all, L::FallibleLender>>, Self: Sized { ... } fn lt<L>(self, other: L) -> Result<bool, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized { ... } fn le<L>(self, other: L) -> Result<bool, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized { ... } fn gt<L>(self, other: L) -> Result<bool, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized { ... } fn ge<L>(self, other: L) -> Result<bool, Self::Error> where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized { ... } fn is_sorted<T>(self) -> Result<bool, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, T: PartialOrd { ... } fn is_sorted_by<T, F>(self, compare: F) -> Result<bool, Self::Error> where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T, &T) -> Result<Option<Ordering>, Self::Error> { ... } fn is_sorted_by_key<F, K>(self, f: F) -> Result<bool, Self::Error> where Self: Sized, F: FnMut(FallibleLend<'_, Self>) -> Result<K, Self::Error>, K: PartialOrd { ... } fn chunky(self, chunk_size: usize) -> Chunky<Self> where Self: Sized + ExactSizeFallibleLender { ... } fn iter<'this>(self) -> Iter<'this, Self> where Self: Sized + 'this, for<'all> FallibleLend<'all, Self>: 'this { ... } fn lender_by_ref<'this>(self) -> FromFallibleIterRef<Iter<'this, Self>> where Self: Sized + 'this, for<'all> FallibleLend<'all, Self>: 'this { ... }
}
Expand description

A trait for dealing with fallible lending iterators.

This is the main fallible lender trait. For more about the concept of lenders generally, please see the crate documentation.

For more about the concept of iterators generally, please see core::iter.

§Covariance Checking

This crate provide a mechanism to guarantee that the Lend type of a fallible lender is covariant in its lifetime. This is crucial to avoid undefined behavior, as many of the operations on lenders rely on covariance to ensure that lends do not outlive their lenders.

The mechanism is based on the __check_covariance method of this trait, which is an internal method for compile-time covariance checking. Adapters relying on covariance of other fallible lenders should call this method for the lenders they are adapting.

The mechanism can be circumvented with unsafe code, and in this case the burden of checking covariance is on the implementor. However, there’s no way to prevent that __check_covariance is implemented vacuously using a non-returning statement (todo!(), unimplemented!(), panic!(), loop {}, etc.), unless you call the method explicitly somewhere in your code. Adapters will call recursively adapted lenders, but there is no way to force the call on the user-facing type.

Required Associated Types§

Source

type Error

The error type.

Required Methods§

Source

fn __check_covariance<'long: 'short, 'short>( proof: CovariantProof<&'short <Self as FallibleLending<'long>>::Lend>, ) -> CovariantProof<&'short <Self as FallibleLending<'short>>::Lend>

Internal method for compile-time covariance checking.

This method should rarely be implemented directly. Instead, use the provided macros:

  • When implementing source lenders (lenders with concrete Lend types), users should invoke check_covariance_fallible! in their FallibleLender impl. The macro implements the method as { proof }, which only compiles if the Lend type is covariant in its lifetime.

  • In all other cases (e.g., when implementing adapters), use unsafe_assume_covariance_fallible! in the FallibleLender impl. The macro implements the method as { unsafe { core::mem::transmute(proof) } }, which is a no-op. This is unsafe because it is up to the implementor to guarantee that the Lend type is covariant in its lifetime.

When relying on covariance of other types, this method should be called in every constructor, or in every method requiring covariance, of such types. In particular, adapters should call this method for the lender they are adapting. The call makes it impossible to implement the check with non-returning code (todo!(), unimplemented!(), panic!(), loop {}, etc.).

See crate::Lender::__check_covariance for more details on how this method works.

Source

fn next(&mut self) -> Result<Option<FallibleLend<'_, Self>>, Self::Error>

Yields the next lend, if any, of the lender, or Ok(None) when iteration is finished.

The behavior of calling this method after a previous call has returned Ok(None) or Err is implementation defined. See FusedFallibleLender for lenders that guarantee Ok(None) is repeated after Ok(None).

Every lend is only guaranteed to be valid one at a time for any kind of lender.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.next(), Ok(Some(&1)));
assert_eq!(lender.next(), Ok(Some(&2)));
assert_eq!(lender.next(), Ok(Some(&3)));
assert_eq!(lender.next(), Ok(None));

Provided Methods§

Source

fn next_chunk(&mut self, chunk_size: usize) -> Chunk<'_, Self>
where Self: Sized,

Takes the next chunk_size lends of the lender with temporary lender Chunk. This is equivalent to cloning the lender and calling take(chunk_size) on it.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut chunk_lender = lender.next_chunk(2);
assert_eq!(chunk_lender.next(), Ok(Some(&1)));
assert_eq!(chunk_lender.next(), Ok(Some(&2)));
assert_eq!(chunk_lender.next(), Ok(None));
Source

fn size_hint(&self) -> (usize, Option<usize>)

Gets the estimated minimum and maximum length of the lender. Both bounds assume that all remaining calls to next() succeed. That is, next() could return an Err in fewer calls than specified by the lower bound.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.size_hint(), (3, Some(3)));
Source

fn count(self) -> Result<usize, Self::Error>
where Self: Sized,

Counts the number of lends in the lender by consuming it until the lender yields Ok(None) or Err(_).

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.count(), Ok(3));
Source

fn last<'call>( &'call mut self, ) -> Result<Option<FallibleLend<'call, Self>>, Self::Error>
where Self: Sized,

Gets the last lend of the lender, if any, by consuming it.

Unlike Iterator::last, this method takes &mut self rather than self because returning a lend that borrows from the lender requires the lender to remain alive.

§Examples
let mut lender =
    lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
        [1, 2, 3].iter().into_fallible(),
    );
assert_eq!(lender.last(), Ok(Some(&3)));
Source

fn advance_by( &mut self, n: usize, ) -> Result<Result<(), NonZeroUsize>, Self::Error>

Advances the lender by n lends.

Returns Ok(Ok(())) if the lender was successfully advanced by n elements. Returns Ok(Err(k)) if the lender did not have enough elements, where k is the number of elements that could not be skipped. Returns Err(e) if an error occurred while advancing.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.advance_by(2), Ok(Ok(())));
assert_eq!(lender.next(), Ok(Some(&3)));
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
// Trying to advance by 5 when only 2 elements remain
assert_eq!(lender.advance_by(5), Ok(Err(NonZeroUsize::new(3).unwrap())));
Source

fn nth( &mut self, n: usize, ) -> Result<Option<FallibleLend<'_, Self>>, Self::Error>

Yields the nth lend of the lender, if any, by consuming it. If the lender does not have enough lends, returns Ok(None).

n is zero-indexed.

§Examples
let data = [1, 2, 3, 4, 5];
let mut lender =
    data.iter().into_lender().into_fallible();
assert_eq!(lender.nth(2), Ok(Some(&3)));
assert_eq!(lender.nth(0), Ok(Some(&4)));
assert_eq!(lender.nth(5), Ok(None));
Source

fn step_by(self, step: usize) -> StepBy<Self>
where Self: Sized,

Skips step - 1 lends between each lend of the lender.

§Panics

Panics if step is zero.

§Examples
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].iter().into_fallible(),
);
let mut step_lender = lender.step_by(2);
assert_eq!(step_lender.next(), Ok(Some(&1)));
assert_eq!(step_lender.next(), Ok(Some(&3)));
assert_eq!(step_lender.next(), Ok(Some(&5)));
assert_eq!(step_lender.next(), Ok(Some(&7)));
assert_eq!(step_lender.next(), Ok(Some(&9)));
assert_eq!(step_lender.next(), Ok(None));
Source

fn chain<U>( self, other: U, ) -> Chain<Self, <U as IntoFallibleLender>::FallibleLender>
where Self: Sized, U: IntoFallibleLender<Error = Self::Error> + for<'all> FallibleLending<'all, Lend = FallibleLend<'all, Self>>,

Chains the lender with another lender of the same type.

The resulting lender will first yield all lends from self, then all lends from other.

§Examples
let a = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
let b = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [3, 4].iter().into_fallible(),
);
let mut chained = a.chain(b);
assert_eq!(chained.next(), Ok(Some(&1)));
assert_eq!(chained.next(), Ok(Some(&2)));
assert_eq!(chained.next(), Ok(Some(&3)));
assert_eq!(chained.next(), Ok(Some(&4)));
assert_eq!(chained.next(), Ok(None));
Source

fn zip<U: IntoFallibleLender>( self, other: U, ) -> Zip<Self, <U as IntoFallibleLender>::FallibleLender>
where Self: Sized,

Zips the lender with another lender of the same or different type.

§Examples
let a = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
let b = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [3, 4].iter().into_fallible(),
);
let mut zipped = a.zip(b);
assert_eq!(zipped.next(), Ok(Some((&1, &3))));
assert_eq!(zipped.next(), Ok(Some((&2, &4))));
assert_eq!(zipped.next(), Ok(None));
Source

fn intersperse<'call>( self, separator: FallibleLend<'call, Self>, ) -> FallibleIntersperse<'call, Self>
where Self: Sized, for<'all> FallibleLend<'all, Self>: Clone,

Intersperses each lend of this lender with the given separator.

§Examples
let sep = 0;
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut inter = lender.intersperse(&sep);
assert_eq!(inter.next(), Ok(Some(&1)));
assert_eq!(inter.next(), Ok(Some(&0)));
assert_eq!(inter.next(), Ok(Some(&2)));
assert_eq!(inter.next(), Ok(Some(&0)));
assert_eq!(inter.next(), Ok(Some(&3)));
assert_eq!(inter.next(), Ok(None));
Source

fn intersperse_with<'call, G>( self, separator: G, ) -> FallibleIntersperseWith<'call, Self, G>
where Self: Sized, G: FnMut() -> Result<FallibleLend<'call, Self>, Self::Error>,

Intersperses each lend of this lender with the separator produced by the given function.

§Examples
let sep = 0;
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut inter = lender.intersperse_with(|| Ok(&sep));
assert_eq!(inter.next(), Ok(Some(&1)));
assert_eq!(inter.next(), Ok(Some(&0)));
assert_eq!(inter.next(), Ok(Some(&2)));
assert_eq!(inter.next(), Ok(Some(&0)));
assert_eq!(inter.next(), Ok(Some(&3)));
assert_eq!(inter.next(), Ok(None));
Source

fn map<F>(self, f: Covar<F>) -> Map<Self, F>
where Self: Sized, F: for<'all> FnMutHKARes<'all, FallibleLend<'all, Self>, Self::Error>,

Maps each lend of this lender using the given function.

Note that functions passed to this method must be built using the covar! or covar_mut! macros, which also checks for covariance of the returned type.

§Examples
let mut data = [1, 2];
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend mut i32), _>(
    data.iter_mut().into_fallible(),
);
let mut mapped = lender.map(covar_mut!(
    for<'all> |a: &'all mut i32| -> Result<&'all i32, Infallible> {
        *a += 1;
        Ok(&*a)
    }
));
assert_eq!(mapped.next().unwrap(), Some(&2));
Source

fn map_err<E, F>(self, f: F) -> MapErr<E, Self, F>
where Self: Sized, F: FnMut(Self::Error) -> E,

Maps the error of this lender using the given function.

§Examples
let data = [Ok(1), Ok(2), Err("oops")];
let mut lender = data.into_iter().into_lender()
    .convert::<&str>()
    .map_err(|e| format!("error: {e}"));
assert_eq!(lender.next(), Ok(Some(1)));
assert_eq!(lender.next(), Ok(Some(2)));
assert_eq!(lender.next(), Err(String::from("error: oops")));
Source

fn map_into_iter<O, F>(self, f: F) -> MapIntoIter<Self, O, F>
where Self: Sized, F: FnMut(FallibleLend<'_, Self>) -> Result<O, Self::Error>,

Maps each lend of this lender into an owned value using the given function.

This is a weaker version of FallibleLender::map that returns a FallibleIterator instead of a FallibleLender. However, this behavior is very common, and so this method is included for convenience. The main advantage is better type inference for the mapping function.

§Examples
let mut data = [1, 2];
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend mut i32), _>(
    data.iter_mut().into_fallible(),
);
let mut mapped_into_iter = lender.map_into_iter(|a| { Ok(*a + 10) });
assert_eq!(mapped_into_iter.next(), Ok(Some(11)));
assert_eq!(mapped_into_iter.next(), Ok(Some(12)));
assert_eq!(mapped_into_iter.next(), Ok(None));
Source

fn for_each<F>(self, f: F) -> Result<(), Self::Error>
where Self: Sized, F: FnMut(FallibleLend<'_, Self>) -> Result<(), Self::Error>,

Calls the given function with each lend of this lender.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut sum = 0;
lender.for_each(|&x| { sum += x; Ok(()) }).unwrap();
assert_eq!(sum, 6);
Source

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where Self: Sized, P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

Filters this lender using the given predicate.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut filtered = lender.filter(|&&x| Ok(x > 1));
assert_eq!(filtered.next(), Ok(Some(&2)));
assert_eq!(filtered.next(), Ok(Some(&3)));
assert_eq!(filtered.next(), Ok(None));
Source

fn filter_map<F>(self, f: Covar<F>) -> FilterMap<Self, F>
where Self: Sized, F: for<'all> FnMutHKAResOpt<'all, FallibleLend<'all, Self>, Self::Error>,

Filters and maps this lender using the given function.

Note that functions passed to this method must be built using the covar! or covar_mut! macros, which also checks for covariance of the returned type.

§Examples
let mut data = [1, 2];
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend mut i32), _>(
    data.iter_mut().into_fallible(),
);
let mut filtered = lender.filter_map(covar_mut!(
    for<'all> |a: &'all mut i32| -> Result<Option<&'all i32>, Infallible> {
        if *a > 1 { Ok(Some(&*a)) } else { Ok(None) }
    }
));
assert_eq!(filtered.next().unwrap(), Some(&2));
Source

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Enumerates this lender. Each lend is paired with its zero-based index.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut enumerated = lender.enumerate();
assert_eq!(enumerated.next(), Ok(Some((0, &1))));
assert_eq!(enumerated.next(), Ok(Some((1, &2))));
assert_eq!(enumerated.next(), Ok(Some((2, &3))));
assert_eq!(enumerated.next(), Ok(None));
Source

fn peekable<'call>(self) -> FalliblePeekable<'call, Self>
where Self: Sized,

Makes this lender peekable, so that it is possible to peek at the next lend without consuming it.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
let mut peekable = lender.peekable();
assert_eq!(peekable.peek(), Ok(Some(&&1)));
assert_eq!(peekable.next(), Ok(Some(&1)));
assert_eq!(peekable.peek(), Ok(Some(&&2)));
assert_eq!(peekable.next(), Ok(Some(&2)));
assert_eq!(peekable.peek(), Ok(None));
Source

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where Self: Sized, P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

Skips the first contiguous sequence of lends of this lender that satisfy the given predicate.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut skipped = lender.skip_while(|&&x| Ok(x < 3));
assert_eq!(skipped.next(), Ok(Some(&3)));
assert_eq!(skipped.next(), Ok(None));
Source

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where Self: Sized, P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

Takes the first contiguous sequence of lends of this lender that satisfy the given predicate.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut taken = lender.take_while(|&&x| Ok(x < 3));
assert_eq!(taken.next(), Ok(Some(&1)));
assert_eq!(taken.next(), Ok(Some(&2)));
assert_eq!(taken.next(), Ok(None));
Source

fn map_while<P>(self, predicate: Covar<P>) -> MapWhile<Self, P>
where Self: Sized, P: for<'all> FnMutHKAResOpt<'all, FallibleLend<'all, Self>, Self::Error>,

Maps this lender using the given function while it returns Some.

Note that functions passed to this method must be built using the covar! or covar_mut! macros, which also checks for covariance of the returned type.

§Examples
let mut data = [1, 2];
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend mut i32), _>(
    data.iter_mut().into_fallible(),
);
let mut mapped = lender.map_while(covar_mut!(
    for<'all> |a: &'all mut i32| -> Result<Option<&'all i32>, Infallible> {
        if *a < 2 { Ok(Some(&*a)) } else { Ok(None) }
    }
));
assert_eq!(mapped.next().unwrap(), Some(&1));
assert_eq!(mapped.next().unwrap(), None);
Source

fn skip(self, n: usize) -> Skip<Self>
where Self: Sized,

Skips the first n lends of this lender.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut skipped = lender.skip(2);
assert_eq!(skipped.next(), Ok(Some(&3)));
assert_eq!(skipped.next(), Ok(None));
Source

fn take(self, n: usize) -> Take<Self>
where Self: Sized,

Takes the first n lends of this lender.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut taken = lender.take(2);
assert_eq!(taken.next(), Ok(Some(&1)));
assert_eq!(taken.next(), Ok(Some(&2)));
assert_eq!(taken.next(), Ok(None));
Source

fn scan<St, F>(self, initial_state: St, f: Covar<F>) -> Scan<Self, St, F>
where Self: Sized, F: for<'all> FnMutHKAResOpt<'all, (&'all mut St, FallibleLend<'all, Self>), Self::Error>,

The FallibleLender version of Iterator::scan.

Note that functions passed to this method must be built using the covar! or covar_mut! macros, which also checks for covariance of the returned type.

§Examples
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut scanned = lender.scan(
    0,
    covar_mut!(
        for<'all> |args: (&'all mut i32, &'all i32)|
            -> Result<Option<&'all i32>, Infallible>
        {
            *args.0 += *args.1;
            Ok(Some(args.1))
        }
    ),
);
assert_eq!(scanned.next().unwrap(), Some(&1));
assert_eq!(scanned.next().unwrap(), Some(&2));
Source

fn flat_map<'call, F>(self, f: Covar<F>) -> FallibleFlatMap<'call, Self, F>
where Self: Sized, F: for<'all> FnMutHKARes<'all, FallibleLend<'all, Self>, Self::Error>, for<'all> <F as FnMutHKARes<'all, FallibleLend<'all, Self>, Self::Error>>::B: IntoFallibleLender<Error = Self::Error>,

The FallibleLender version of Iterator::flat_map.

Note that functions passed to this method must be built using the covar! or covar_mut! macros, which also checks for covariance of the returned type.

§Examples
// Define a wrapper that implements FallibleLender
struct VecLender(Vec<i32>);

impl<'lend> FallibleLending<'lend> for VecLender {
    type Lend = i32;
}

impl FallibleLender for VecLender {
    type Error = Infallible;
    check_covariance_fallible!();
    fn next(&mut self) -> Result<Option<FallibleLend<'_, Self>>, Self::Error> {
        Ok(if self.0.is_empty() { None } else { Some(self.0.remove(0)) })
    }
}

let data = [1, 2, 3];
let mut flat = data.into_iter().into_lender().into_fallible().flat_map(
    covar_mut!(for<'lend> |x: i32| -> Result<VecLender, Infallible> {
        Ok(VecLender(vec![x, x * 10]))
    })
);
assert_eq!(flat.next().unwrap(), Some(1));
assert_eq!(flat.next().unwrap(), Some(10));
assert_eq!(flat.next().unwrap(), Some(2));
Source

fn flatten<'call>(self) -> FallibleFlatten<'call, Self>
where Self: Sized, for<'all> FallibleLend<'all, Self>: IntoFallibleLender<Error = Self::Error>,

The FallibleLender version of Iterator::flatten.

§Examples
let data = [vec![1, 2], vec![3, 4]];
let lender = data.into_iter().into_lender()
    .into_fallible();
let mut flat = lender.map(covar!(
    for<'all> |v: Vec<i32>|
        -> Result<lender::IntoFallible<lender::FromIter<
            std::vec::IntoIter<i32>
        >>, Infallible>
    {
        Ok(v.into_iter().into_lender().into_fallible())
    }
)).flatten();
assert_eq!(flat.next().unwrap(), Some(1));
assert_eq!(flat.next().unwrap(), Some(2));
assert_eq!(flat.next().unwrap(), Some(3));
assert_eq!(flat.next().unwrap(), Some(4));
assert_eq!(flat.next().unwrap(), None);
Source

fn fuse(self) -> Fuse<Self>
where Self: Sized,

The FallibleLender version of Iterator::fuse.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
let mut fused = lender.fuse();
assert_eq!(fused.next(), Ok(Some(&1)));
assert_eq!(fused.next(), Ok(Some(&2)));
assert_eq!(fused.next(), Ok(None));
assert_eq!(fused.next(), Ok(None));
Source

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where Self: Sized, F: FnMut(&FallibleLend<'_, Self>) -> Result<(), Self::Error>,

The FallibleLender version of Iterator::inspect.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut sum = 0;
let mut inspected = lender.inspect(|&x| { sum += x; Ok(()) });
assert_eq!(inspected.next(), Ok(Some(&1)));
assert_eq!(inspected.next(), Ok(Some(&2)));
assert_eq!(inspected.next(), Ok(Some(&3)));
assert_eq!(inspected.next(), Ok(None));
assert_eq!(sum, 6);
Source

fn mutate<F>(self, f: F) -> Mutate<Self, F>
where Self: Sized, F: FnMut(&mut FallibleLend<'_, Self>) -> Result<(), Self::Error>,

Mutates each lend with the given function.

§Examples
let mut data = [1, 2, 3];
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend mut i32), _>(
    data.iter_mut().into_fallible(),
);
let mut mutated = lender.mutate(|x| { **x += 10; Ok(()) });
assert_eq!(mutated.next(), Ok(Some(&mut 11)));
assert_eq!(mutated.next(), Ok(Some(&mut 12)));
assert_eq!(mutated.next(), Ok(Some(&mut 13)));
assert_eq!(mutated.next(), Ok(None));
Source

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

The FallibleLender version of Iterator::by_ref.

§Examples
let data = [1, 2, 3, 4, 5];
let mut lender =
    data.iter().into_lender().into_fallible();
// Consume two elements through by_ref.
assert_eq!(
    lender.by_ref().next(),
    Ok(Some(&1))
);
assert_eq!(
    lender.by_ref().next(),
    Ok(Some(&2))
);
// The original lender continues from where
// we left off.
assert_eq!(lender.next(), Ok(Some(&3)));
Source

fn collect<B>(self) -> Result<B, (B, Self::Error)>
where Self: Sized, for<'all> B: FromLender<NonFallibleAdapter<'all, Self>>,

Transforms the fallible lender into a collection. If any invocation of next returns Err, returns the collection built from values yielded successfully, together with the error.

§Error Handling

The return type Result<B, (B, Self::Error)> preserves partial results even on error: the B inside the Err variant contains whatever was accumulated before the error occurred.

§Examples
let lender = [1, 2, 3].into_iter().into_lender().into_fallible();
let collected: Result<Vec<i32>, _> = lender.owned().collect();
assert_eq!(collected, Ok(vec![1, 2, 3]));
Source

fn try_collect<'a, B, T>(&'a mut self) -> Result<T, (T, Self::Error)>
where Self: Sized, for<'all> FallibleLend<'all, Self>: Try, for<'all> <FallibleLend<'all, Self> as Try>::Residual: Residual<B, TryType = T>, for<'b, 'c, 'd> B: FromLender<FallibleTryShuntAdapter<'b, 'c, 'd, 'a, Self>>,

Collects the lends of a fallible lender that are themselves Try types into a collection of their outputs, short-circuiting on both lender errors and Try failures.

The FallibleLender version of Lender::try_collect.

On error, returns the collection (with partial results) together with the error.

Source

fn collect_into<E>( self, collection: &mut E, ) -> Result<&mut E, (&mut E, Self::Error)>
where Self: Sized, for<'all> E: ExtendLender<NonFallibleAdapter<'all, Self>>,

Extends an existing collection with lends from this fallible lender.

The FallibleLender version of Lender::collect_into. On error, returns the collection (with partial results) together with the error.

Source

fn partition<'this, E, F>(self, f: F) -> Result<(E, E), ((E, E), Self::Error)>
where Self: Sized + 'this, E: Default + ExtendLender<NonFallibleAdapter<'this, Self>>, F: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

The FallibleLender version of Iterator::partition.

On error, returns the partial results accumulated so far together with the error, matching the convention used by collect.

Source

fn is_partitioned<P>(self, predicate: P) -> Result<bool, Self::Error>
where Self: Sized, P: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

The FallibleLender version of Iterator::is_partitioned.

§Examples
// [1, 3, 2, 4] is partitioned: all odd elements come before all even.
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 3, 2, 4].iter().into_fallible(),
);
assert!(lender.is_partitioned(|&x| Ok(x % 2 != 0)).unwrap());
Source

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Result<R, Self::Error>
where F: FnMut(B, FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = B>,

The FallibleLender version of Iterator::try_fold.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let sum = lender.try_fold(0, |acc: i32, &x| Ok(acc.checked_add(x)));
assert_eq!(sum, Ok(Some(6)));
Source

fn try_for_each<F, R>(&mut self, f: F) -> Result<R, Self::Error>
where F: FnMut(FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = ()>,

The FallibleLender version of Iterator::try_for_each.

§Examples
let mut lender =
    lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
        [1, 2, 3].iter().into_fallible(),
    );
let result = lender.try_for_each(|&x| {
    if x < 3 { Ok(Some(())) } else { Ok(None) }
});
assert_eq!(result, Ok(None));
Source

fn fold<B, F>(self, init: B, f: F) -> Result<B, Self::Error>
where Self: Sized, F: FnMut(B, FallibleLend<'_, Self>) -> Result<B, Self::Error>,

The FallibleLender version of Iterator::fold.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let sum = lender.fold(0, |acc, &x| Ok(acc + x));
assert_eq!(sum, Ok(6));
// Example concatenating strings
let data = ["hello", " ", "world"];
let lender = lender::lend_fallible_iter::<fallible_lend!(&&'lend str), _>(
    data.iter().into_fallible(),
);
let result = lender.fold(String::new(), |mut acc, &s| {
    acc.push_str(s);
    Ok(acc)
});
assert_eq!(result, Ok(String::from("hello world")));
Source

fn reduce<T, F>(self, f: F) -> Result<Option<T>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(T, FallibleLend<'_, Self>) -> Result<T, Self::Error>,

The FallibleLender version of Iterator::reduce.

§Error Handling

If the closure or the underlying lender returns an error, reduce propagates it immediately. Unlike collect, the partial accumulation is not preserved on error.

Source

fn try_reduce<T, F, R>( self, f: F, ) -> Result<ChangeOutputType<R, Option<T>>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(T, FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = T>, R::Residual: Residual<Option<T>>,

The FallibleLender version of Iterator::try_reduce.

§Examples
let lender =
    [1, 2, 3].into_iter().into_lender().into_fallible();
let sum = lender.try_reduce(|acc: i32, x| {
    Ok(acc.checked_add(x))
});
assert_eq!(sum, Ok(Some(Some(6))));
Source

fn all<F>(&mut self, f: F) -> Result<bool, Self::Error>
where F: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

The FallibleLender version of Iterator::all.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.all(|&x| Ok(x > 0)), Ok(true));
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.all(|&x| Ok(x > 2)), Ok(false));
Source

fn any<F>(&mut self, f: F) -> Result<bool, Self::Error>
where F: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

The FallibleLender version of Iterator::any.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.any(|&x| Ok(x == 2)), Ok(true));
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.any(|&x| Ok(x > 5)), Ok(false));
Source

fn find<P>( &mut self, predicate: P, ) -> Result<Option<FallibleLend<'_, Self>>, Self::Error>
where P: FnMut(&FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

The FallibleLender version of Iterator::find.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.find(|&&x| Ok(x == 2)), Ok(Some(&2)));
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.find(|&&x| Ok(x > 10)), Ok(None));
Source

fn find_map<'a, F>( &'a mut self, f: F, ) -> Result<Option<<F as FnMutHKAResOpt<'a, FallibleLend<'a, Self>, Self::Error>>::B>, Self::Error>
where Self: Sized, F: for<'all> FnMutHKAResOpt<'all, FallibleLend<'all, Self>, Self::Error>,

The FallibleLender version of Iterator::find_map.

§Examples
let mut lender =
    [1, 2, 3].into_iter().into_lender().into_fallible();
let found = lender.find_map(|x: i32| {
    Ok(if x > 1 { Some(x * 10) } else { None })
});
assert_eq!(found, Ok(Some(20)));
Source

fn try_find<F, R>( &mut self, f: F, ) -> Result<ChangeOutputType<R, Option<FallibleLend<'_, Self>>>, Self::Error>
where Self: Sized, F: FnMut(&FallibleLend<'_, Self>) -> Result<R, Self::Error>, R: Try<Output = bool>, for<'all> R::Residual: Residual<Option<FallibleLend<'all, Self>>>,

The FallibleLender version of Iterator::try_find.

§Examples
let mut lender =
    lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
        [1, 2, 3].iter().into_fallible(),
    );
let result =
    lender.try_find(|&x| Ok(Some(*x > 1)));
assert_eq!(result, Ok(Some(Some(&2))));
Source

fn position<P>(&mut self, predicate: P) -> Result<Option<usize>, Self::Error>
where Self: Sized, P: FnMut(FallibleLend<'_, Self>) -> Result<bool, Self::Error>,

The FallibleLender version of Iterator::position.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.position(|&x| Ok(x == 2)), Ok(Some(1)));
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
assert_eq!(lender.position(|&x| Ok(x > 10)), Ok(None));
Source

fn rposition<P>(&mut self, predicate: P) -> Result<Option<usize>, Self::Error>

The FallibleLender version of Iterator::rposition.

§Examples
let mut lender =
    [1, 2, 3, 2, 1].iter().into_lender().into_fallible();
assert_eq!(
    lender.rposition(|&x| Ok(x == 2)),
    Ok(Some(3))
);
Source

fn max<T: Ord>(self) -> Result<Option<T>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>,

The FallibleLender version of Iterator::max.

§Examples
let lender =
    [1, 3, 2].into_iter().into_lender().into_fallible();
assert_eq!(lender.max(), Ok(Some(3)));
Source

fn min<T: Ord>(self) -> Result<Option<T>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>,

The FallibleLender version of Iterator::min.

§Examples
let lender =
    [3, 1, 2].into_iter().into_lender().into_fallible();
assert_eq!(lender.min(), Ok(Some(1)));
Source

fn max_by_key<B: Ord, T, F>(self, f: F) -> Result<Option<T>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T) -> Result<B, Self::Error>,

The FallibleLender version of Iterator::max_by_key.

§Examples
let lender =
    ["a", "bbb", "cc"].into_iter().into_lender().into_fallible();
assert_eq!(lender.max_by_key(|s| Ok(s.len())), Ok(Some("bbb")));
Source

fn max_by<T, F>(self, compare: F) -> Result<Option<T>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T, &FallibleLend<'_, Self>) -> Result<Ordering, Self::Error>,

The FallibleLender version of Iterator::max_by.

§Examples
let lender =
    ["a", "bbb", "cc"].into_iter().into_lender().into_fallible();
assert_eq!(
    lender.max_by(|x, y| Ok(x.len().cmp(&y.len()))),
    Ok(Some("bbb"))
);
Source

fn min_by_key<B: Ord, T, F>(self, f: F) -> Result<Option<T>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T) -> Result<B, Self::Error>,

The FallibleLender version of Iterator::min_by_key.

§Examples
let lender =
    ["a", "bbb", "cc"].into_iter().into_lender().into_fallible();
assert_eq!(lender.min_by_key(|s| Ok(s.len())), Ok(Some("a")));
Source

fn min_by<T, F>(self, compare: F) -> Result<Option<T>, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T, &FallibleLend<'_, Self>) -> Result<Ordering, Self::Error>,

The FallibleLender version of Iterator::min_by.

§Examples
let lender =
    ["a", "bbb", "cc"].into_iter().into_lender().into_fallible();
assert_eq!(
    lender.min_by(|x, y| Ok(x.len().cmp(&y.len()))),
    Ok(Some("a"))
);
Source

fn rev(self) -> Rev<Self>

The FallibleLender version of Iterator::rev.

§Examples
let mut lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
)
.rev();
assert_eq!(lender.next(), Ok(Some(&3)));
assert_eq!(lender.next(), Ok(Some(&2)));
assert_eq!(lender.next(), Ok(Some(&1)));
assert_eq!(lender.next(), Ok(None));
Source

fn unzip<ExtA, ExtB>(self) -> Result<(ExtA, ExtB), Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: TupleLend<'all>, ExtA: Default + for<'this> ExtendLender<NonFallibleAdapter<'this, <FirstShunt<Self> as IntoFallibleLender>::FallibleLender>>, ExtB: Default + for<'this> ExtendLender<NonFallibleAdapter<'this, <SecondShunt<Self> as IntoFallibleLender>::FallibleLender>>,

Source

fn copied<T>(self) -> Copied<Self>
where Self: Sized + for<'all> FallibleLending<'all, Lend = &'all T>, T: Copy,

The FallibleLender version of Iterator::copied.

Turns this FallibleLender into a FallibleIterator.

§Examples
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut copied = lender.copied();
assert_eq!(copied.next()?, Some(1));
assert_eq!(copied.next()?, Some(2));
assert_eq!(copied.next()?, Some(3));
assert_eq!(copied.next()?, None);
Source

fn cloned<T>(self) -> Cloned<Self>
where Self: Sized + for<'all> FallibleLending<'all, Lend = &'all T>, T: Clone,

The FallibleLender version of Iterator::cloned.

Turns this FallibleLender into a FallibleIterator.

§Examples
let lender = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2, 3].iter().into_fallible(),
);
let mut cloned = lender.cloned();
assert_eq!(cloned.next()?, Some(1));
assert_eq!(cloned.next()?, Some(2));
assert_eq!(cloned.next()?, Some(3));
assert_eq!(cloned.next()?, None);
Source

fn owned(self) -> Owned<Self>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned,

Turns this FallibleLender into a FallibleIterator.

§Examples
let mut owned = [1, 2, 3].into_iter().into_lender().into_fallible().owned();
assert_eq!(owned.next()?, Some(1));
assert_eq!(owned.next()?, Some(2));
assert_eq!(owned.next()?, Some(3));
assert_eq!(owned.next()?, None);
Source

fn cycle(self) -> Cycle<Self>
where Self: Sized + Clone,

The FallibleLender version of Iterator::cycle.

§Examples
let mut cycled = [1, 2].iter().into_lender().into_fallible().cycle();
assert_eq!(cycled.next(), Ok(Some(&1)));
assert_eq!(cycled.next(), Ok(Some(&2)));
assert_eq!(cycled.next(), Ok(Some(&1)));
assert_eq!(cycled.next(), Ok(Some(&2)));
Source

fn sum<S>(self) -> Result<S, Self::Error>
where Self: Sized, S: SumFallibleLender<Self>,

The FallibleLender version of Iterator::sum.

Note: This method requires a type implementing SumFallibleLender. For simple numeric sums, consider using owned() and then FallibleIterator::sum().

Source

fn product<P>(self) -> Result<P, Self::Error>
where Self: Sized, P: ProductFallibleLender<Self>,

The FallibleLender version of Iterator::product.

Note: This method requires a type implementing ProductFallibleLender. For simple numeric products, consider using owned() and then FallibleIterator::product().

Source

fn cmp<L>(self, other: L) -> Result<Ordering, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, L::FallibleLender: for<'all> FallibleLending<'all, Lend = FallibleLend<'all, Self>>, for<'all> FallibleLend<'all, Self>: Ord, Self: Sized,

The FallibleLender version of Iterator::cmp.

Note: Due to HRTB limitations, consider using cmp_by instead.

§Examples
let a = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
let b = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 3].iter().into_fallible(),
);
assert_eq!(a.cmp(b), Ok(Ordering::Less));
Source

fn cmp_by<L, F>(self, other: L, cmp: F) -> Result<Ordering, Self::Error>
where Self: Sized, L: IntoFallibleLender<Error = Self::Error>, F: for<'all> FnMut(FallibleLend<'all, Self>, FallibleLend<'all, L::FallibleLender>) -> Result<Ordering, Self::Error>,

The FallibleLender version of Iterator::cmp_by.

Note: the closure receives both lends under a single lifetime (for<'all>). This is an HRTB limitation: the two lenders cannot be advanced independently within the closure.

§Examples
let a = [1, 2, 3].into_iter().into_lender().into_fallible();
let b = [1, 2, 4].into_iter().into_lender().into_fallible();
assert_eq!(
    a.cmp_by::<lender::IntoFallible<_>, _>(b, |x: i32, y: i32| Ok(x.cmp(&y))),
    Ok(Ordering::Less)
);
Source

fn partial_cmp<L>(self, other: L) -> Result<Option<Ordering>, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized,

The FallibleLender version of Iterator::partial_cmp.

Note: Due to HRTB limitations, consider using partial_cmp_by instead.

§Examples
let a = [1, 2].into_iter().into_lender().into_fallible();
let b = [1, 3].into_iter().into_lender().into_fallible();
assert_eq!(
    a.partial_cmp::<lender::IntoFallible<_>>(b),
    Ok(Some(Ordering::Less))
);
Source

fn partial_cmp_by<L, F>( self, other: L, partial_cmp: F, ) -> Result<Option<Ordering>, Self::Error>
where Self: Sized, L: IntoFallibleLender<Error = Self::Error>, F: for<'all> FnMut(FallibleLend<'all, Self>, FallibleLend<'all, L::FallibleLender>) -> Result<Option<Ordering>, Self::Error>,

The FallibleLender version of Iterator::partial_cmp_by.

See cmp_by for a note on the unified lifetime constraint.

§Examples
let a = [1, 2].into_iter().into_lender().into_fallible();
let b = [1, 3].into_iter().into_lender().into_fallible();
assert_eq!(
    a.partial_cmp_by::<lender::IntoFallible<_>, _>(
        b,
        |x: i32, y: i32| Ok(x.partial_cmp(&y))
    ),
    Ok(Some(Ordering::Less))
);
Source

fn eq<L>(self, other: L) -> Result<bool, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialEq<FallibleLend<'all, L::FallibleLender>>, Self: Sized,

The FallibleLender version of Iterator::eq.

Note: Due to HRTB limitations, consider using eq_by instead.

Source

fn eq_by<L, F>(self, other: L, eq: F) -> Result<bool, Self::Error>
where Self: Sized, L: IntoFallibleLender<Error = Self::Error>, F: for<'all> FnMut(FallibleLend<'all, Self>, FallibleLend<'all, L::FallibleLender>) -> Result<bool, Self::Error>,

The FallibleLender version of Iterator::eq_by.

See cmp_by for a note on the unified lifetime constraint.

§Examples
let a = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
let b = lender::lend_fallible_iter::<fallible_lend!(&'lend i32), _>(
    [1, 2].iter().into_fallible(),
);
assert_eq!(a.eq_by(b, |x, y| Ok(x == y)), Ok(true));
Source

fn ne<L>(self, other: L) -> Result<bool, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialEq<FallibleLend<'all, L::FallibleLender>>, Self: Sized,

The FallibleLender version of Iterator::ne.

Note: Due to HRTB limitations, consider using eq_by instead.

§Examples
let a = [1, 2].into_iter().into_lender().into_fallible();
let b = [1, 3].into_iter().into_lender().into_fallible();
assert_eq!(a.ne::<lender::IntoFallible<_>>(b), Ok(true));
Source

fn lt<L>(self, other: L) -> Result<bool, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized,

The FallibleLender version of Iterator::lt.

Note: Due to HRTB limitations, consider using partial_cmp_by instead.

§Examples
let a = [1, 2].into_iter().into_lender().into_fallible();
let b = [1, 3].into_iter().into_lender().into_fallible();
assert_eq!(a.lt::<lender::IntoFallible<_>>(b), Ok(true));
Source

fn le<L>(self, other: L) -> Result<bool, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized,

The FallibleLender version of Iterator::le.

Note: Due to HRTB limitations, consider using partial_cmp_by instead.

§Examples
let a = [1, 2].into_iter().into_lender().into_fallible();
let b = [1, 2].into_iter().into_lender().into_fallible();
assert_eq!(a.le::<lender::IntoFallible<_>>(b), Ok(true));
Source

fn gt<L>(self, other: L) -> Result<bool, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized,

The FallibleLender version of Iterator::gt.

Note: Due to HRTB limitations, consider using partial_cmp_by instead.

§Examples
let a = [1, 3].into_iter().into_lender().into_fallible();
let b = [1, 2].into_iter().into_lender().into_fallible();
assert_eq!(a.gt::<lender::IntoFallible<_>>(b), Ok(true));
Source

fn ge<L>(self, other: L) -> Result<bool, Self::Error>
where L: IntoFallibleLender<Error = Self::Error>, for<'all> FallibleLend<'all, Self>: PartialOrd<FallibleLend<'all, L::FallibleLender>>, Self: Sized,

The FallibleLender version of Iterator::ge.

Note: Due to HRTB limitations, consider using partial_cmp_by instead.

§Examples
let a = [1, 2].into_iter().into_lender().into_fallible();
let b = [1, 2].into_iter().into_lender().into_fallible();
assert_eq!(a.ge::<lender::IntoFallible<_>>(b), Ok(true));
Source

fn is_sorted<T>(self) -> Result<bool, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, T: PartialOrd,

The FallibleLender version of Iterator::is_sorted.

§Examples
let lender = [1, 2, 3].into_iter().into_lender().into_fallible();
assert_eq!(lender.is_sorted(), Ok(true));

let lender = [1, 3, 2].into_iter().into_lender().into_fallible();
assert_eq!(lender.is_sorted(), Ok(false));
Source

fn is_sorted_by<T, F>(self, compare: F) -> Result<bool, Self::Error>
where Self: Sized, for<'all> FallibleLend<'all, Self>: ToOwned<Owned = T>, F: FnMut(&T, &T) -> Result<Option<Ordering>, Self::Error>,

The FallibleLender version of Iterator::is_sorted_by.

§Examples
// Sorted in descending order.
let lender = [3, 2, 1].into_iter().into_lender().into_fallible();
assert_eq!(
    lender.is_sorted_by(|a, b| Ok(b.partial_cmp(a))),
    Ok(true)
);
Source

fn is_sorted_by_key<F, K>(self, f: F) -> Result<bool, Self::Error>
where Self: Sized, F: FnMut(FallibleLend<'_, Self>) -> Result<K, Self::Error>, K: PartialOrd,

The FallibleLender version of Iterator::is_sorted_by_key.

§Examples
let lender =
    ["a", "bbb", "cc"].into_iter().into_lender().into_fallible();
assert_eq!(
    lender.is_sorted_by_key(|s| Ok(s.len())),
    Ok(false)
);

let lender =
    ["a", "cc", "bbb"].into_iter().into_lender().into_fallible();
assert_eq!(
    lender.is_sorted_by_key(|s| Ok(s.len())),
    Ok(true)
);
Source

fn chunky(self, chunk_size: usize) -> Chunky<Self>

A lending replacement for Iterator::array_chunks.

This method returns a lender that yields lenders returning the next chunk_size lends.

§Panics

Panics if chunk_size is zero.

§Examples
let data = [1, 2, 3, 4, 5];
let lender = data.iter().into_lender().into_fallible();
let mut chunky = lender.chunky(2);
let mut chunk1 = chunky.next().unwrap().unwrap();
assert_eq!(chunk1.next().unwrap(), Some(&1));
assert_eq!(chunk1.next().unwrap(), Some(&2));
assert_eq!(chunk1.next().unwrap(), None);
let mut chunk2 = chunky.next().unwrap().unwrap();
assert_eq!(chunk2.next().unwrap(), Some(&3));
assert_eq!(chunk2.next().unwrap(), Some(&4));
assert_eq!(chunk2.next().unwrap(), None);
let mut chunk3 = chunky.next().unwrap().unwrap();
assert_eq!(chunk3.next().unwrap(), Some(&5));
assert_eq!(chunk3.next().unwrap(), None);
Source

fn iter<'this>(self) -> Iter<'this, Self>
where Self: Sized + 'this, for<'all> FallibleLend<'all, Self>: 'this,

Turns this FallibleLender into a FallibleIterator where it has already fulfilled the requirements of the FallibleIterator trait.

Note: Due to HRTB limitations, consider using copied, cloned, or owned instead when applicable.

§Examples
let lender =
    [1, 2, 3].into_iter().into_lender().into_fallible();
let v: Vec<i32> = lender.iter().collect().unwrap();
assert_eq!(v, vec![1, 2, 3]);
Source

fn lender_by_ref<'this>(self) -> FromFallibleIterRef<Iter<'this, Self>>
where Self: Sized + 'this, for<'all> FallibleLend<'all, Self>: 'this,

Turns this FallibleLender into a new FallibleLender that lends references to the items of the original lender.

This is a convenience for self.iter().into_fallible_ref_lender(): first, iter converts this lender into a FallibleIterator; then, into_fallible_ref_lender wraps it back into a FallibleLender that stores each element and lends a reference to it.

The resulting lender has FallibleLend<'lend> = &'lend FallibleLend<'this, Self>.

§Examples
let mut lender =
    [1, 2, 3].into_iter().into_lender()
        .into_fallible().lender_by_ref();
let item: &i32 =
    lender.next().unwrap().unwrap();
assert_eq!(*item, 1);

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.

Implementations on Foreign Types§

Source§

impl<L: FallibleLender> FallibleLender for &mut L

Source§

type Error = <L as FallibleLender>::Error

Source§

fn __check_covariance<'long: 'short, 'short>( proof: CovariantProof<&'short <Self as FallibleLending<'long>>::Lend>, ) -> CovariantProof<&'short <Self as FallibleLending<'short>>::Lend>

Source§

fn next(&mut self) -> Result<Option<FallibleLend<'_, Self>>, Self::Error>

Source§

fn size_hint(&self) -> (usize, Option<usize>)

Source§

fn advance_by( &mut self, n: usize, ) -> Result<Result<(), NonZeroUsize>, Self::Error>

Implementors§

Source§

impl<'a, L, E> FallibleLender for Once<'a, L, E>
where E: 'a, L: ?Sized + CovariantFallibleLending,

Source§

type Error = E

Source§

impl<'a, L, E> FallibleLender for Repeat<'a, L, E>
where L: ?Sized + CovariantFallibleLending + 'a, E: 'a, for<'all> FallibleLend<'all, L>: Clone,

Source§

type Error = E

Source§

impl<'a, L, E, F> FallibleLender for RepeatWith<'a, L, E, F>
where L: ?Sized + CovariantFallibleLending + 'a, F: FnMut() -> FallibleLend<'a, L>,

Source§

type Error = E

Source§

impl<'a, L, I> FallibleLender for LendIter<'a, L, I>
where L: ?Sized + CovariantFallibleLending + 'a, I: FallibleIterator<Item = FallibleLend<'a, L>>,

Source§

impl<'this, L> FallibleLender for Intersperse<'this, L>
where for<'all> FallibleLend<'all, L>: Clone, L: FallibleLender,

Source§

impl<'this, L> FallibleLender for Peekable<'this, L>
where L: FallibleLender,

Source§

impl<'this, L, G> FallibleLender for IntersperseWith<'this, L, G>
where L: FallibleLender, G: FnMut() -> Result<FallibleLend<'this, L>, L::Error>,

Source§

impl<A, B> FallibleLender for Chain<A, B>
where A: FallibleLender, B: FallibleLender<Error = A::Error> + for<'all> FallibleLending<'all, Lend = FallibleLend<'all, A>>,

Source§

impl<A, B> FallibleLender for Zip<A, B>
where A: FallibleLender, B: FallibleLender<Error = A::Error>,

Source§

impl<E, I> FallibleLender for Convert<E, I>
where I: LenderResult<E>,

Source§

type Error = E

Source§

impl<E, L, F> FallibleLender for MapErr<E, L, F>
where F: FnMut(L::Error) -> E, L: FallibleLender,

Source§

type Error = E

Source§

impl<I: FallibleIterator> FallibleLender for FromIter<I>

Source§

impl<I: FallibleIterator> FallibleLender for FromIterRef<I>

Source§

impl<L> FallibleLender for Chunky<L>
where L: FallibleLender,

Source§

impl<L> FallibleLender for Cycle<L>
where L: Clone + FallibleLender,

Source§

impl<L> FallibleLender for Enumerate<L>
where L: FallibleLender,

Source§

impl<L> FallibleLender for Fuse<L>
where L: FallibleLender,

Source§

impl<L> FallibleLender for IntoFallible<L>
where L: Lender,

Source§

impl<L> FallibleLender for Rev<L>

Source§

impl<L> FallibleLender for Skip<L>
where L: FallibleLender,

Source§

impl<L> FallibleLender for StepBy<L>
where L: FallibleLender,

Source§

impl<L> FallibleLender for Take<L>
where L: FallibleLender,

Source§

impl<L, E> FallibleLender for Empty<L, E>
where L: ?Sized + for<'all> FallibleLending<'all>,

Source§

type Error = E

Source§

impl<L, E> FallibleLender for OnceErr<L, E>
where L: ?Sized + CovariantFallibleLending,

Source§

type Error = E

Source§

impl<L, E> FallibleLender for RepeatErr<L, E>
where L: ?Sized + CovariantFallibleLending, E: Clone,

Source§

type Error = E

Source§

impl<L, E, F> FallibleLender for RepeatWithErr<L, F>
where L: ?Sized + CovariantFallibleLending, F: FnMut() -> E,

Source§

type Error = E

Source§

impl<L, F> FallibleLender for FilterMap<L, F>
where for<'all> F: FnMutHKAResOpt<'all, FallibleLend<'all, L>, L::Error>, L: FallibleLender,

Source§

impl<L, F> FallibleLender for Inspect<L, F>
where L: FallibleLender, F: FnMut(&FallibleLend<'_, L>) -> Result<(), L::Error>,

Source§

impl<L, F> FallibleLender for Map<L, F>
where F: for<'all> FnMutHKARes<'all, FallibleLend<'all, L>, L::Error>, L: FallibleLender,

Source§

impl<L, F> FallibleLender for Mutate<L, F>
where L: FallibleLender, F: FnMut(&mut FallibleLend<'_, L>) -> Result<(), L::Error>,

Source§

impl<L, P> FallibleLender for Filter<L, P>
where P: FnMut(&FallibleLend<'_, L>) -> Result<bool, L::Error>, L: FallibleLender,

Source§

impl<L, P> FallibleLender for MapWhile<L, P>
where P: for<'all> FnMutHKAResOpt<'all, FallibleLend<'all, L>, L::Error>, L: FallibleLender,

Source§

impl<L, P> FallibleLender for SkipWhile<L, P>
where P: FnMut(&FallibleLend<'_, L>) -> Result<bool, L::Error>, L: FallibleLender,

Source§

impl<L, P> FallibleLender for TakeWhile<L, P>
where P: FnMut(&FallibleLend<'_, L>) -> Result<bool, L::Error>, L: FallibleLender,

Source§

impl<L, St, F> FallibleLender for Scan<L, St, F>
where for<'all> F: FnMutHKAResOpt<'all, (&'all mut St, FallibleLend<'all, L>), L::Error>, L: FallibleLender,

Source§

impl<L: FallibleLender> FallibleLender for Flatten<'_, L>
where for<'all> FallibleLend<'all, L>: IntoFallibleLender<Error = L::Error>,

Source§

impl<L: FallibleLender, F> FallibleLender for FlatMap<'_, L, F>
where Map<L, F>: FallibleLender<Error = L::Error>, for<'all> FallibleLend<'all, Map<L, F>>: IntoFallibleLender<Error = L::Error>,

Source§

impl<St, E, F> FallibleLender for OnceWith<St, E, F>
where F: for<'all> FnOnceHKA<'all, &'all mut St>,

Source§

type Error = E

Source§

impl<St, E, F> FallibleLender for FromFn<St, E, F>
where F: for<'all> FnMutHKAResOpt<'all, &'all mut St, E>,

Source§

type Error = E

Source§

impl<St, L, E, F> FallibleLender for OnceWithErr<St, L, F>
where L: ?Sized + CovariantFallibleLending, F: FnOnce(&mut St) -> E,

Source§

type Error = E

Source§

impl<T> FallibleLender for Chunk<'_, T>
where T: FallibleLender,