5 releases (3 breaking)
0.4.0 | Mar 5, 2021 |
---|---|
0.3.0 | Jan 12, 2021 |
0.2.0 | Jan 11, 2021 |
0.1.1 | Jan 9, 2021 |
0.1.0 | Jan 9, 2021 |
#694 in Debugging
1,018 downloads per month
34KB
548 lines
This no_std compatible library provides several useful constructs to format data in a human-readable fashion with zero allocations.
Why hand-roll annoying and verbose formatting code everywhere...
for i, item in list.iter().enumerate() {
if i == list.len() - 1 {
println!("{}", item);
} else {
print!("{} - ", item);
}
}
...when you could just use this?
println!("{}", display_utils::join(list, " - "));
This library makes ingenious use of Rust's formatting abstractions to provide super flexible and powerful formatting utilities, without any allocations.
For more information, please see the documentation: https://docs.rs/display_utils
lib.rs
:
This library aims to provide useful constructs to vastly simplify data formatting tasks.
Being a no_std library, no allocations will be made, ever. Even with this restriction however, the provided functions are flexible and ergonomic.
This code snippet:
for (i, item) in list.iter().enumerate() {
if i == list.len() - 1 {
println!("{}", item);
} else {
print!("{} - ", item);
}
}
...simplifies to:
println!("{}", display_utils::join(list, " - "));
Other functions work in a similar fashion. Browser through the crate functions for an overview of what you can do.
Extension traits (DisplayExt
, IteratorExt
) which may be used to make method chains
more readable.