Skip to main content

Crate custom_display

Crate custom_display 

Source
Expand description

A library for writing custom formats for types, or for adding handling of precision, width, fill and alignment to non-numeric types that implement Display.

Structs§

DefaultNonNumeric
See default_non_numeric().
Displayable
A wrapper around a CustomDisplay and a value that implements Display by calling CustomDisplay::fmt() with the value, automatically truncates the result of CustomDisplay::fmt() based on precision if CustomDisplay::precision_behavior() returns AutoTruncate, and handles width, fill and alignment if CustomDisplay::auto_width_fill_alignment() returns true.

Enums§

PrecisionBehavior
The behavior of a Displayable when a precision is set.

Traits§

CustomDisplay
A custom format, roughly equivalent to Display except that it is not restricted by coherence.

Functions§

default_non_numeric
Returns a CustomDisplay that provides handling of precision, width, fill and alignment in the way specified by std::fmt for non-numeric types.
display_non_numeric
Returns a wrapper around the given value that handles precision, width, fill and alignment in the way specified by std::fmt for non-numeric types.

Type Aliases§

BorrowedDisplayable
A Displayable that borrows its CustomDisplay.
OwnedDisplayable
A Displayable that owns its CustomDisplay.