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§
- Pad to both sides, place content in the middle, but shift to the left one block if it can’t be exactly central.
- Pad to both sides, place content in the middle, but shift to the right one block if it can’t be exactly central.
- Pad to the right, content to the left.
- Pad to the left, content to the right.
- Treat character count as width.
- Forbid all excesses, raise
fmt::Error
once encounter one. - Information about a situation where
total_width
is less thanvalue.width()
. - Turn a function (without closure) into a
ExcessHandler
. - Ignore excess, write
value
toformatter
without padding. - Treat
str::len
as width. - Pad all values in a collection to be of same (maximum) width.
- Builder for
PaddedColumn
. - Iterator created by calling
into_iter
onPaddedColumn
. - Pad a single value.
- Builder for
PaddedValue
. - Forbid all excesses, panic once encounter one.
- Treat
UnicodeWidthStr::width
as width. - Treat
UnicodeWidthStr::width_cjk
as width.
Enums§
- Where the place the pad blocks.
- Error type for PaddedColumnBuilder
- Error type for PaddedValueBuilder
Constants§
- The version of Unicode that this version of unicode-width is based on.
Traits§
- What to do when the width of the value exceeds total.
- Pad a value knowing the number of blocks.
- Methods for determining displayed width of Unicode characters.
- Methods for determining displayed width of Unicode strings.
- All zero-sized types in this crate implement this trait.
- All pre-defined zero-sized
ExcessHandler
types in this crate implement this trait. - Value that has width.
Functions§
- Pad space characters both side of a value with the remainder block (if any) in the right.
- Pad space characters both side of a value with the remainder block (if any) in the 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.
- 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.
- Pad space characters to the right of every value so that they all share the same width.
- Pad space characters to the left of every value so that they all share the same width.
- Pad space characters to the right of a value.
- Pad space characters to the left of a value.
- Create a
ExcessHandlingFunction
that forbids excesses. - Create a
ExcessHandlingFunction
that ignores excesses. - Create a
ExcessHandlingFunction
that forbids excesses.