pub fn csv_once<I>(iter: I) -> CsvOnce<I::IntoIter>where
I: IntoIterator,
Expand description
Concatenates Iterator
items with ,
between each, at most once.
This is equivalent to join_once(iter, ", ")
.
This is a non-Clone
alternative to csv()
. It uses interior
mutability to take ownership of the iterator in the first call to
Display::fmt()
. As a result, CsvOnce
does not implement Sync
.
Examples
let value = fmty::csv_once(["hola", "mundo"]);
assert_eq!(value.to_string(), "hola, mundo");
assert_eq!(value.to_string(), "");