Skip to main content

fallible_repeat_with

Function fallible_repeat_with 

Source
pub fn fallible_repeat_with<'a, L, E, F>(f: F) -> RepeatWith<'a, L, E, F>
where L: ?Sized + CovariantFallibleLending + 'a, F: FnMut() -> FallibleLend<'a, L>,
Expand description

Creates a new fallible lender that repeats elements endlessly by applying the provided closure, the repeater, F: FnMut() -> A.

The repeat_with() function calls the repeater over and over again.

The FallibleLender version of iter::repeat_with(): the closure returns a value directly (not a Result).

To create a lender that endlessly repeats errors generated by a closure, use repeat_with_err().

ยงExamples

let mut lender = lender::fallible_repeat_with::<
    '_, fallible_lend!(&'lend i32), String, _,
>(|| &0);
assert_eq!(lender.next().unwrap(), Some(&0));