Expand description
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.
Macros§
- Concatenate arbitrarily many instances of different types.
Structs§
- See
concat(). - See
slice(); - See
join(). - See
join_format(). - See
lowercase(). - See
ordinal(). - See
repeat(). - See
replace(). - See
replace_n(). - See
unicode_block_bar(). - See
uppercase().
Traits§
- Extension trait providing convenient access to the base functions in the crate root.
- Extension trait providing convenient access to the base functions in the crate root.
Functions§
- Lexicographically compares a Display object against a string.
- Write a Display object into a fixed-size buffer and returns the resulting &str.
- Write a Display object into a fixed-size buffer and returns the resulting &mut str.
- Concatenate the contents of an iterator.
- Concatenate iterator elements, separating each element pair with a given joiner.
- Concatenate iterator elements, separating each element pair with a given joiner, where each iterator element can be formatted using a callback.
- Print a Unicode-compliant lowercase version of the Display object.
- Create an ordinal from a number.
- Repeat an object a certain number of times.
- Replace instances of the
fromstring with thetoDisplay object. - Replace the first n instances of the
fromstring with thetostring. - Extract a slice from the given Display object, similar to indexing a
&str. - Print a loading-style bar using Unicode block characters.
- Print a Unicode-compliant uppercase version of the string.
- Print a sequence of equalizer-style vertical bars using Unicode block characters.