Trait lender::Lending

source ·
pub trait Lending<'lend, __ImplBound: ImplBound = Ref<'lend, Self>> {
    type Lend: 'lend;
}
Expand description

A trait for dealing with the ‘items’ of lending iterators.

Must be defined for any type that implements Lender.

It implicitly restricts the lifetime 'lend used in Lending<'lend> to be where Self: 'lend.

This is a result of Higher-Ranked Trait Bounds (HRTBs) not having a way to express qualifiers (for<'any where Self: 'any> Self: Trait) and effectively making HRTBs only useful when you want to express a trait constraint on ALL lifetimes, including ’static (for<'all> Self: trait)

Although the common example of implementing your own LendingIterator uses a (type Item<'a> where Self: 'a;) GAT, that generally only works withing a small subset of the features that a LendingIterator needs to provide to be comparable to Iterator.

Please see Sabrina Jewson’s Blog for more information, and how a trait like this can be used to solve it by implicitly restricting HRTBs.

Required Associated Types§

source

type Lend: 'lend

The type being lent.

Implementations on Foreign Types§

source§

impl<'lend, L: Lender> Lending<'lend> for &mut L

§

type Lend = <L as Lending<'lend>>::Lend

Implementors§

source§

impl<'a, 'any, T> Lending<'any> for WindowsMut<'a, T>

§

type Lend = &'any mut [T]

source§

impl<'a, 'any, T, const WINDOW_SIZE: usize> Lending<'any> for ArrayWindowsMut<'a, T, WINDOW_SIZE>

§

type Lend = &'any mut [T; WINDOW_SIZE]

source§

impl<'a, 'lend, L> Lending<'lend> for Once<'a, L>
where L: ?Sized + for<'all> Lending<'all>,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'a, 'lend, L, I> Lending<'lend> for LendIter<'a, L, I>
where L: ?Sized + for<'all> Lending<'all> + 'a, I: Iterator<Item = Lend<'a, L>>,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, 'a, L> Lending<'lend> for Repeat<'a, L>
where L: ?Sized + for<'all> Lending<'all> + 'a, for<'all> Lend<'all, L>: Clone,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, 'a, L, F> Lending<'lend> for RepeatWith<'a, L, F>
where L: ?Sized + for<'all> Lending<'all> + 'a, F: FnMut() -> Lend<'a, L>,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, 's, T> Lending<'lend> for Chunk<'s, T>
where T: Lender,

§

type Lend = <T as Lending<'lend>>::Lend

source§

impl<'lend, 'this, L> Lending<'lend> for Intersperse<'this, L>
where for<'all> Lend<'all, L>: Clone, L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, 'this, L> Lending<'lend> for Peekable<'this, L>
where L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, 'this, L, G> Lending<'lend> for IntersperseWith<'this, L, G>
where L: Lender, G: FnMut() -> Lend<'this, L>,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, 'this, L: Lender> Lending<'lend> for Flatten<'this, L>
where for<'all> Lend<'all, L>: IntoLender,

§

type Lend = <<<L as Lending<'this>>::Lend as IntoLender>::Lender as Lending<'lend>>::Lend

source§

impl<'lend, 'this, L: Lender> Lending<'lend> for TryShunt<'this, L>
where for<'all> Lend<'all, L>: Try,

§

type Lend = <<L as Lending<'lend>>::Lend as Try>::Output

source§

impl<'lend, 'this, L: Lender, F> Lending<'lend> for FlatMap<'this, L, F>
where Map<L, F>: Lender, for<'all> Lend<'all, Map<L, F>>: IntoLender,

§

type Lend = <<<Map<L, F> as Lending<'this>>::Lend as IntoLender>::Lender as Lending<'lend>>::Lend

source§

impl<'lend, A, B> Lending<'lend> for Chain<A, B>
where A: Lender, B: Lender + for<'all> Lending<'all, Lend = Lend<'all, A>>,

§

type Lend = <A as Lending<'lend>>::Lend

source§

impl<'lend, A, B> Lending<'lend> for Zip<A, B>
where A: Lender, B: Lender,

§

type Lend = (<A as Lending<'lend>>::Lend, <B as Lending<'lend>>::Lend)

source§

impl<'lend, B, L, F> Lending<'lend> for FilterMap<L, F>
where F: FnMut(Lend<'lend, L>) -> Option<B>, B: 'lend, L: Lender,

§

type Lend = B

source§

impl<'lend, B, L, P> Lending<'lend> for MapWhile<L, P>
where P: FnMut(Lend<'lend, L>) -> Option<B>, L: Lender, B: 'lend,

§

type Lend = B

source§

impl<'lend, B, L, St, F> Lending<'lend> for Scan<L, St, F>
where F: FnMut((&'lend mut St, Lend<'lend, L>)) -> Option<B>, L: Lender, B: 'lend,

§

type Lend = B

source§

impl<'lend, I: Iterator> Lending<'lend> for FromIter<I>

§

type Lend = <I as Iterator>::Item

source§

impl<'lend, L> Lending<'lend> for Chunky<L>
where L: Lender,

§

type Lend = Chunk<'lend, L>

source§

impl<'lend, L> Lending<'lend> for Cycle<L>
where L: Clone + Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L> Lending<'lend> for Empty<L>
where L: ?Sized + for<'all> Lending<'all>,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L> Lending<'lend> for Enumerate<L>
where L: Lender,

§

type Lend = (usize, <L as Lending<'lend>>::Lend)

source§

impl<'lend, L> Lending<'lend> for Fuse<L>
where L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L> Lending<'lend> for Rev<L>
where L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L> Lending<'lend> for Skip<L>
where L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L> Lending<'lend> for StepBy<L>
where L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L> Lending<'lend> for Take<L>
where L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L, F> Lending<'lend> for Inspect<L, F>
where L: Lender, F: FnMut(&Lend<'lend, L>),

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L, F> Lending<'lend> for Map<L, F>
where F: for<'all> FnMutHKA<'all, Lend<'all, L>>, L: Lender,

§

type Lend = <F as FnMutHKA<'lend, <L as Lending<'lend>>::Lend>>::B

source§

impl<'lend, L, F> Lending<'lend> for Mutate<L, F>
where L: Lender, F: FnMut(&mut Lend<'lend, L>),

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L, P> Lending<'lend> for Filter<L, P>
where P: FnMut(&Lend<'lend, L>) -> bool, L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L, P> Lending<'lend> for SkipWhile<L, P>
where P: FnMut(&Lend<'lend, L>) -> bool, L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L, P> Lending<'lend> for TakeWhile<L, P>
where P: FnMut(&Lend<'lend, L>) -> bool, L: Lender,

§

type Lend = <L as Lending<'lend>>::Lend

source§

impl<'lend, L: Lender> Lending<'lend> for FirstShunt<L>
where for<'all> Lend<'all, L>: TupleLend<'all>,

§

type Lend = <<L as Lending<'lend>>::Lend as TupleLend<'lend>>::First

source§

impl<'lend, L: Lender> Lending<'lend> for SecondShunt<L>
where for<'all> Lend<'all, L>: TupleLend<'all>,

§

type Lend = <<L as Lending<'lend>>::Lend as TupleLend<'lend>>::Second

source§

impl<'lend, St, F> Lending<'lend> for FromFn<St, F>
where F: for<'all> FnMutHKAOpt<'all, &'all mut St>,

§

type Lend = <F as FnMutHKAOpt<'lend, &'lend mut St>>::B

source§

impl<'lend, St, F> Lending<'lend> for OnceWith<St, F>
where F: for<'all> FnOnceHKA<'all, &'all mut St>,

§

type Lend = <F as FnOnceHKA<'lend, &'lend mut St>>::B