pub fn repeat_with<F>(n: usize, f: F) -> RepeatWith<F>Expand description
Repeats n results of a closure.
ยงExamples
use std::cell::Cell;
let counter = Cell::new(1);
let value = fmty::repeat_with(3, || {
let result = counter.get();
counter.set(result + 1);
result
});
assert_eq!(value.to_string(), "123");