pub fn repeat_display<F>(
count: usize,
sep: &str,
fmt_one: F,
) -> RepeatDisplay<'_, F>
Expand description
Construct a RepeatDisplay that will repeatedly call fmt_one
with a formatter count
times,
separated by sep
.
ยงExample
assert_eq!(format!("{}", repeat_display(1, ",", |i, f| write!(f, "({},?)", i))),
"(0,?)");
assert_eq!(format!("{}", repeat_display(2, ",", |i, f| write!(f, "({},?)", i))),
"(0,?),(1,?)");
assert_eq!(format!("{}", repeat_display(3, ",", |i, f| write!(f, "({},?)", i))),
"(0,?),(1,?),(2,?)");