Module fmt

Source
Expand description

Formatting-related items

Panic formatting for custom types can be done in these ways (in increasing order of verbosity):

  • Using the PanicFmt derive macro (requires the opt-in "derive" feature)
  • Using the impl_panicfmt macro (requires the default-enabled "non_basic" feature)
  • Using the flatten_panicvals macro (requires the default-enabled "non_basic" feature)
  • Manually implementing the PanicFmt trait as described in its docs.

Re-exports§

pub use self::Delimiter::CloseBrace;
pub use self::Delimiter::CloseBracket;
pub use self::Delimiter::CloseParen;
pub use self::Delimiter::Empty as EmptyDelimiter;
pub use self::Delimiter::OpenBrace;
pub use self::Delimiter::OpenBracket;
pub use self::Delimiter::OpenParen;

Modules§

char_formatting
char-formatted related items

Structs§

ComputePvCount
For computing the PanicFmt::PV_COUNT of a struct or enum variant, with the call method.
FmtArg
Carries all of the configuration for formatting functions.
IsCustomType
Marker type used as the PanicFmt::Kind for user-defined types.
IsPanicFmt
A marker type that proves that S implements PanicFmt<This = T, Kind = K>.
IsStdType
Marker type used as the PanicFmt::Kind associated type for std types.
PackedFmtArg
A version of FmtArg which occupies less space, but needs to be unpacked to be used.
Separator
For alternate flag-aware separation of fields, collection elements, etc.

Enums§

Delimiter
For outputting an alternate flag-aware delimiter.
FmtKind
What kind of formatting to do, either Display or Debug.
IsLast
For telling Separator whether it comes after the last field or not.
NumberFmt
What integers are formatted as.
TypeDelim
Whether a struct or variant is Tupled or Braced.

Constants§

COMMA_SEP
An alternate-flag-aware comma separator for use between fields or elements.
COMMA_TERM
An alternate-flag-aware comma for use after the last field or element.
INDENTATION_STEP
How much indentation (in spaces) is added with FmtArg::indent, and removed with FmtArg::unindent.
SHORT_STRING_CAP
The capacity of a ShortString.

Traits§

CoerceReturn
Computes the type that the T argument is converted into by IsPanicFmt::coerce.
PanicFmt
Trait for types that can be formatted by const panics.

Type Aliases§

CoerceReturnOutput
Computes the type that the T argument is converted into by IsPanicFmt::coerce.
ShortString
A stack allocated string type that’s convertible into PanicVal<'static>, with SHORT_STRING_CAP capacity.