| Crates.io | printerator |
| lib.rs | printerator |
| version | 1.0.1 |
| created_at | 2025-11-13 13:19:46.812488+00 |
| updated_at | 2025-11-14 03:49:30.358987+00 |
| description | simply print iterators without collecting them |
| homepage | |
| repository | https://github.com/Paladynee/printerator |
| max_upload_size | |
| id | 1931126 |
| size | 36,190 |
Print iterators without having to collect them.
# use printerator::PrinterateDebug;
let ints: [u32; 3] = [0xcafebabe, 0xabad1dea, 0xdeadc0de];
println!(
"{:.1?}",
ints.iter().map(|&int| (int as f32).sqrt()).printerd(),
);
# use printerator::PrinterateDisplay;
let data = "Hello, w🌍rld!";
let mut nonascii_iter = data.bytes().enumerate().filter(|&(_, b)| b >= 128);
println!(
"Invalid ascii byte indices: {}",
nonascii_iter.clone().map(|(i, _)| i).printer_with_options(false, false),
);
Available in 2 flavors: A debug printer, and a display printer, both of
which are createble over any iterator whose item is implementing either
[Debug] or [Display], using the methods printerd and printer respectively.
Formatting options are passed as-is to the [Iterator::Item]'s implementation of
[Debug] and [Display]. That means you should pass them in as if you were
formatting 1 single item.
printer{d}_with_options arguments:
pretty: true if you want newlines and brackets:[
item,
item2,
item3
]
[
0: item,
1: item2
]
otherwise, false:
item, item2, item3
0: item, 1: item2
indices: true if you want the indices too:[
0: item,
1: item2
]
0: item, 1: item2, 2: item3
otherwise, false:
[
item,
item2
]
item, item2