helper formatting array elements with a comma and a space between them
(
iter: I,
f: &mut Formatter,
format_element: F,
)
| 113 | |
| 114 | /// helper formatting array elements with a comma and a space between them |
| 115 | fn fmt_elements_split_by_commas<E, I, F>( |
| 116 | iter: I, |
| 117 | f: &mut Formatter, |
| 118 | format_element: F, |
| 119 | ) -> FmtResult |
| 120 | where |
| 121 | I: Iterator<Item = E>, |
| 122 | F: Fn(E, &mut Formatter) -> FmtResult, |
| 123 | { |
| 124 | for (idx, element) in iter.enumerate() { |
| 125 | if idx > 0 { |
| 126 | write!(f, ", ")?; |
| 127 | } |
| 128 | format_element(element, f)?; |
| 129 | } |
| 130 | Ok(()) |
| 131 | } |
| 132 | |
| 133 | #[cfg(test)] |
| 134 | mod tests { |
no outgoing calls
no test coverage detected
searching dependent graphs…