Crate zero_copy_pads

Crate zero_copy_pads 

Source
Expand description

Padding/aligning values without heap allocation.

Features:

  • std (default feature):
    • Disable #![no_std].
    • Enable features that require heap allocation.

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§

AlignCenterLeft
Pad to both sides, place content in the middle, but shift to the left one block if it can’t be exactly central.
AlignCenterRight
Pad to both sides, place content in the middle, but shift to the right one block if it can’t be exactly central.
AlignLeft
Pad to the right, content to the left.
AlignRight
Pad to the left, content to the right.
CharCount
Treat character count as width.
ErrorOnExcess
Forbid all excesses, raise fmt::Error once encounter one.
Excess
Information about a situation where total_width is less than value.width().
ExcessHandlingFunction
Turn a function (without closure) into a ExcessHandler.
IgnoreExcess
Ignore excess, write value to formatter without padding.
Len
Treat str::len as width.
PaddedColumn
Pad all values in a collection to be of same (maximum) width.
PaddedColumnBuilder
Builder for PaddedColumn.
PaddedColumnIter
Iterator created by calling into_iter on PaddedColumn.
PaddedValue
Pad a single value.
PaddedValueBuilder
Builder for PaddedValue.
PanicOnExcess
Forbid all excesses, panic once encounter one.
UnicodeWidth
Treat UnicodeWidthStr::width as width.
UnicodeWidthCjk
Treat UnicodeWidthStr::width_cjk as width.

Enums§

Alignment
Where the place the pad blocks.
PaddedColumnBuilderError
Error type for PaddedColumnBuilder
PaddedValueBuilderError
Error type for PaddedValueBuilder

Constants§

UNICODE_VERSION
The version of Unicode that this version of unicode-width is based on.

Traits§

ExcessHandler
What to do when the width of the value exceeds total.
Pad
Pad a value knowing the number of blocks.
UnicodeWidthChar
Methods for determining displayed width of Unicode characters.
UnicodeWidthStr
Methods for determining displayed width of Unicode strings.
Unit
All zero-sized types in this crate implement this trait.
UnitExcessHandler
All pre-defined zero-sized ExcessHandler types in this crate implement this trait.
UnitPad
All pre-defined zero-sized Pad types 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 ExcessHandlingFunction that forbids excesses.
ignore_excess
Create a ExcessHandlingFunction that ignores excesses.
panic_on_excess
Create a ExcessHandlingFunction that forbids excesses.