Crate printerator

Crate printerator 

Source
Expand description

§printerator

Print iterators without having to collect them.

let ints: [u32; _] = [0xcafebabe, 0xabad1dea, 0xdeadc0de];
assert_eq!(
    format!(
        "{:.1}",
        ints.iter().map(|&int| (int as f32).sqrt()).printerd_with_options(false, false),
    ),
    ""
);

Available in 2 flavors: debug_printer, display_printer.

Formatting options are passed as-is to the Item type. That means you should pass them in as if you were formatting 1 single item.

Options

  • pretty: true if you want newlines and brackets:
[
    item,
    item2,
    item3,
]

otherwise, false:

item, item2, item3
  • indices: true if you want the indices too:
{
    0: item,
    1: item2,
}
// or
0: item, 1: item2, 2: item3

otherwise, false:

{
    item,
    item2,
}
// or
item, item2

Structs§

PrintingIteratorDebug
PrintingIteratorDisplay

Traits§

PrinterateDebug
PrinterateDisplay