[−][src]Function sql_support::repeat_display
pub fn repeat_display<F>(
count: usize,
sep: &str,
fmt_one: F
) -> RepeatDisplay<'_, F> where
F: Fn(usize, &mut Formatter<'_>) -> Result,
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,?)");