Expand description
Padding/aligning values without heap allocation.
Features:
std(default feature):- Disable
#![no_std]. - Enable features that require heap allocation.
- Disable
Usage:
Almost all items are documented with example codes, such as
align_left, align_right, align_center_left, align_center_right,
align_column_left, align_column_right,
align_column_center_left, align_column_center_right,
PaddedValue, PaddedColumn, Alignment,
AlignLeft, AlignRight, AlignCenterLeft, AlignCenterRight,
etc.
Re-exports§
pub use fmt_iter;
Structs§
- Align
Center Left - Pad to both sides, place content in the middle, but shift to the left one block if it can’t be exactly central.
- Align
Center Right - Pad to both sides, place content in the middle, but shift to the right one block if it can’t be exactly central.
- Align
Left - Pad to the right, content to the left.
- Align
Right - Pad to the left, content to the right.
- Char
Count - Treat character count as width.
- Error
OnExcess - Forbid all excesses, raise
fmt::Erroronce encounter one. - Excess
- Information about a situation where
total_widthis less thanvalue.width(). - Excess
Handling Function - Turn a function (without closure) into a
ExcessHandler. - Ignore
Excess - Ignore excess, write
valuetoformatterwithout padding. - Len
- Treat
str::lenas width. - Padded
Column - Pad all values in a collection to be of same (maximum) width.
- Padded
Column Builder - Builder for
PaddedColumn. - Padded
Column Iter - Iterator created by calling
into_iteronPaddedColumn. - Padded
Value - Pad a single value.
- Padded
Value Builder - Builder for
PaddedValue. - Panic
OnExcess - Forbid all excesses, panic once encounter one.
- Unicode
Width - Treat
UnicodeWidthStr::widthas width. - Unicode
Width Cjk - Treat
UnicodeWidthStr::width_cjkas width.
Enums§
- Alignment
- Where the place the pad blocks.
- Padded
Column Builder Error - Error type for PaddedColumnBuilder
- Padded
Value Builder Error - Error type for PaddedValueBuilder
Constants§
- UNICODE_
VERSION - The version of Unicode that this version of unicode-width is based on.
Traits§
- Excess
Handler - What to do when the width of the value exceeds total.
- Pad
- Pad a value knowing the number of blocks.
- Unicode
Width Char - Methods for determining displayed width of Unicode characters.
- Unicode
Width Str - Methods for determining displayed width of Unicode strings.
- Unit
- All zero-sized types in this crate implement this trait.
- Unit
Excess Handler - All pre-defined zero-sized
ExcessHandlertypes in this crate implement this trait. - UnitPad
- All pre-defined zero-sized
Padtypes in this crate implement this trait. - Width
- Value that has width.
Functions§
- align_
center_ left - Pad space characters both side of a value with the remainder block (if any) in the right.
- align_
center_ right - Pad space characters both side of a value with the remainder block (if any) in the left.
- align_
column_ center_ left - Pad space characters to both sides of every value so that they all share the same width. The remainder blocks will be placed at the right.
- align_
column_ center_ right - Pad space characters to both sides of every value so that they all share the same width. The remainder blocks will be placed at the left.
- align_
column_ left - Pad space characters to the right of every value so that they all share the same width.
- align_
column_ right - Pad space characters to the left of every value so that they all share the same width.
- align_
left - Pad space characters to the right of a value.
- align_
right - Pad space characters to the left of a value.
- error_
on_ excess - Create a
ExcessHandlingFunctionthat forbids excesses. - ignore_
excess - Create a
ExcessHandlingFunctionthat ignores excesses. - panic_
on_ excess - Create a
ExcessHandlingFunctionthat forbids excesses.