Function fmty::csv_map

source ·
pub fn csv_map<I, R, F>(iter: I, f: F) -> CsvMap<I::IntoIter, F>where
    I: IntoIterator,
    I::IntoIter: Clone,
    F: Fn(I::Item) -> R,
Expand description

Concatenates mapped Iterator results with , between each.

Unlike csv(iter.map(f)), this function does not require the mapping closure to be Clone.

If Clone for the Iterator is too expensive, consider using csv_map_once().

Examples

let value = fmty::csv_map(["hola", "mundo"], fmty::to_ascii_uppercase);
assert_eq!(value.to_string(), "HOLA, MUNDO");