pub struct RepeatWith<'a, L: ?Sized, F> { /* private fields */ }Expand description
A lender that repeats an element endlessly by applying a closure.
This struct is created by the repeat_with() function.
Trait Implementations§
Source§impl<L: ?Sized, F> Debug for RepeatWith<'_, L, F>
impl<L: ?Sized, F> Debug for RepeatWith<'_, L, F>
Source§impl<'a, L, F> DoubleEndedLender for RepeatWith<'a, L, F>
impl<'a, L, F> DoubleEndedLender for RepeatWith<'a, L, F>
Source§fn next_back(&mut self) -> Option<Lend<'_, Self>>
fn next_back(&mut self) -> Option<Lend<'_, Self>>
Removes and returns a lend from the end of the lender. Read more
Source§fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
Advances the lender from the back by
n elements. Read moreSource§fn nth_back(&mut self, n: usize) -> Option<Lend<'_, Self>>
fn nth_back(&mut self, n: usize) -> Option<Lend<'_, Self>>
Returns the
nth element from the end of the lender. Read moreSource§fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
The reverse version of
Lender::try_fold: it takes elements starting from
the back of the lender. Read moreSource§fn rfold<B, F>(self, init: B, f: F) -> B
fn rfold<B, F>(self, init: B, f: F) -> B
The reverse version of
Lender::fold: it takes elements starting from
the back of the lender. Read moreSource§impl<'a, L, F> Lender for RepeatWith<'a, L, F>
impl<'a, L, F> Lender for RepeatWith<'a, L, F>
Source§fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
Advances the lender by n elements.
Unlike Repeat::advance_by, which is
a no-op, this method calls the closure n times
(discarding the results) because the closure may have
side effects.
Source§fn __check_covariance<'long: 'short, 'short>(
proof: CovariantProof<<Self as Lending<'long>>::Lend>,
) -> CovariantProof<<Self as Lending<'short>>::Lend>
fn __check_covariance<'long: 'short, 'short>( proof: CovariantProof<<Self as Lending<'long>>::Lend>, ) -> CovariantProof<<Self as Lending<'short>>::Lend>
Internal method for compile-time covariance checking. Read more
Source§fn next(&mut self) -> Option<Lend<'_, Self>>
fn next(&mut self) -> Option<Lend<'_, Self>>
Yields the next lend, if any, of the lender. Read more
Source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Gets the estimated minimum and maximum length of the lender. Use
.len() for the exact length if the lender
implements ExactSizeLender. Read moreSource§fn next_chunk(&mut self, chunk_size: usize) -> Chunk<'_, Self>where
Self: Sized,
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. Read moreSource§fn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere
Self: Sized,
Counts the number of lends in the lender by consuming it. Read more
Source§fn last<'call>(&'call mut self) -> Option<Lend<'call, Self>>where
Self: Sized,
fn last<'call>(&'call mut self) -> Option<Lend<'call, Self>>where
Self: Sized,
Gets the last lend of the lender, if any, by consuming it. Read more
Source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
Skips
step - 1 lends between each lend of the lender. Read moreSource§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoLender>::Lender>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoLender>::Lender>
Chains the lender with another lender of the same type. Read more
Source§fn zip<U: IntoLender>(self, other: U) -> Zip<Self, <U as IntoLender>::Lender>where
Self: Sized,
fn zip<U: IntoLender>(self, other: U) -> Zip<Self, <U as IntoLender>::Lender>where
Self: Sized,
Zips the lender with another lender of the same or different type. Read more
Source§fn intersperse<'call>(
self,
separator: Lend<'call, Self>,
) -> Intersperse<'call, Self>
fn intersperse<'call>( self, separator: Lend<'call, Self>, ) -> Intersperse<'call, Self>
Intersperses each lend of this lender with the given separator. Read more
Source§fn intersperse_with<'call, G>(
self,
separator: G,
) -> IntersperseWith<'call, Self, G>
fn intersperse_with<'call, G>( self, separator: G, ) -> IntersperseWith<'call, Self, G>
Intersperses each lend of this lender with the separator produced by
the given function. Read more
Source§fn map<F>(self, f: Covar<F>) -> Map<Self, F>
fn map<F>(self, f: Covar<F>) -> Map<Self, F>
Maps each lend of this lender using the given function. Read more
Source§fn map_into_iter<O, F: FnMut(Lend<'_, Self>) -> O>(
self,
f: F,
) -> MapIntoIter<Self, O, F> ⓘwhere
Self: Sized,
fn map_into_iter<O, F: FnMut(Lend<'_, Self>) -> O>(
self,
f: F,
) -> MapIntoIter<Self, O, F> ⓘwhere
Self: Sized,
Maps each lend of this lender into an owned value using the given function. Read more
Source§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
Filters this lender using the given predicate. Read more
Source§fn filter_map<F>(self, f: Covar<F>) -> FilterMap<Self, F>
fn filter_map<F>(self, f: Covar<F>) -> FilterMap<Self, F>
Filters and maps this lender using the given function. Read more
Source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
Enumerates this lender. Each lend is paired with its zero-based index. Read more
Source§fn peekable<'call>(self) -> Peekable<'call, Self>where
Self: Sized,
fn peekable<'call>(self) -> Peekable<'call, Self>where
Self: Sized,
Makes this lender peekable, so that it is possible to peek at the next
lend without consuming it. Read more
Source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
Skips the first contiguous sequence of lends of this lender that
satisfy the given predicate. Read more
Source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Takes the first contiguous sequence of lends of this lender that
satisfy the given predicate. Read more
Source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
Skips the first
n lends of this lender. Read moreSource§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Takes the first
n lends of this lender. Read moreSource§fn mutate<F>(self, f: F) -> Mutate<Self, F>
fn mutate<F>(self, f: F) -> Mutate<Self, F>
Mutates each lend with the given function. Read more
Source§fn collect<B>(self) -> Bwhere
Self: Sized,
B: FromLender<Self>,
fn collect<B>(self) -> Bwhere
Self: Sized,
B: FromLender<Self>,
Source§fn try_collect<'a, B>(&'a mut self) -> ChangeOutputType<Lend<'a, Self>, B>
fn try_collect<'a, B>(&'a mut self) -> ChangeOutputType<Lend<'a, Self>, B>
Source§fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere
Self: Sized,
E: ExtendLender<Self>,
fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere
Self: Sized,
E: ExtendLender<Self>,
Source§fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
Source§fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
Source§fn try_reduce<T, F, R>(self, f: F) -> ChangeOutputType<R, Option<T>>
fn try_reduce<T, F, R>(self, f: F) -> ChangeOutputType<R, Option<T>>
Source§fn find_map<'a, F>(
&'a mut self,
f: F,
) -> Option<<F as FnMutHKAOpt<'a, Lend<'a, Self>>>::B>
fn find_map<'a, F>( &'a mut self, f: F, ) -> Option<<F as FnMutHKAOpt<'a, Lend<'a, Self>>>::B>
Source§fn max_by_key<B: Ord, T, F>(self, f: F) -> Option<T>
fn max_by_key<B: Ord, T, F>(self, f: F) -> Option<T>
Source§fn min_by_key<B: Ord, T, F>(self, f: F) -> Option<T>
fn min_by_key<B: Ord, T, F>(self, f: F) -> Option<T>
Source§fn unzip<ExtA, ExtB>(self) -> (ExtA, ExtB)where
Self: Sized,
for<'all> Lend<'all, Self>: TupleLend<'all>,
ExtA: Default + ExtendLender<FirstShunt<Self>>,
ExtB: Default + ExtendLender<SecondShunt<Self>>,
fn unzip<ExtA, ExtB>(self) -> (ExtA, ExtB)where
Self: Sized,
for<'all> Lend<'all, Self>: TupleLend<'all>,
ExtA: Default + ExtendLender<FirstShunt<Self>>,
ExtB: Default + ExtendLender<SecondShunt<Self>>,
Source§fn product<P>(self) -> Pwhere
Self: Sized,
P: ProductLender<Self>,
fn product<P>(self) -> Pwhere
Self: Sized,
P: ProductLender<Self>,
Source§fn partial_cmp<L>(self, other: L) -> Option<Ordering>
fn partial_cmp<L>(self, other: L) -> Option<Ordering>
Source§fn partial_cmp_by<L, F>(self, other: L, partial_cmp: F) -> Option<Ordering>
fn partial_cmp_by<L, F>(self, other: L, partial_cmp: F) -> Option<Ordering>
Source§fn is_sorted_by<T, F>(self, compare: F) -> bool
fn is_sorted_by<T, F>(self, compare: F) -> bool
Source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
Source§fn lender_by_ref<'this>(self) -> FromIterRef<Iter<'this, Self>>
fn lender_by_ref<'this>(self) -> FromIterRef<Iter<'this, Self>>
Source§fn convert<E>(self) -> Convert<E, Self>where
Self: Sized,
fn convert<E>(self) -> Convert<E, Self>where
Self: Sized,
Converts a
Lender whose lend type is Result<T, E> into a
FallibleLender with error type E and lend type T. Read moreSource§fn into_fallible(self) -> IntoFallible<Self>where
Self: Sized,
fn into_fallible(self) -> IntoFallible<Self>where
Self: Sized,
Converts a
Lender into a FallibleLender
by wrapping into Result<Lend<'_, Self>, Infallible> where
Infallible is an error that can never actually happen. Read moreSource§impl<'lend, 'a, L, F> Lending<'lend> for RepeatWith<'a, L, F>
impl<'lend, 'a, L, F> Lending<'lend> for RepeatWith<'a, L, F>
impl<'a, L, F> FusedLender for RepeatWith<'a, L, F>
Auto Trait Implementations§
impl<'a, L, F> Freeze for RepeatWith<'a, L, F>
impl<'a, L, F> RefUnwindSafe for RepeatWith<'a, L, F>
impl<'a, L, F> Send for RepeatWith<'a, L, F>
impl<'a, L, F> Sync for RepeatWith<'a, L, F>
impl<'a, L, F> Unpin for RepeatWith<'a, L, F>
impl<'a, L, F> UnsafeUnpin for RepeatWith<'a, L, F>where
F: UnsafeUnpin,
L: ?Sized,
impl<'a, L, F> UnwindSafe for RepeatWith<'a, L, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more