pub struct FormatSpec<'tcx> {
    pub fill: Option<char>,
    pub align: Alignment,
    pub flags: u32,
    pub precision: Count<'tcx>,
    pub width: Count<'tcx>,
    pub trait: Symbol,
    pub trait_span: Option<Span>,
}
Expand description

Specification for the formatting of an argument in the format string. See https://doc.rust-lang.org/std/fmt/index.html#formatting-parameters for the precise meanings.

Fields§

§fill: Option<char>

Optionally specified character to fill alignment with.

§align: Alignment

Optionally specified alignment.

§flags: u32

Packed version of various flags provided, see rustc_parse_format::Flag.

§precision: Count<'tcx>

Represents either the maximum width or the integer precision.

§width: Count<'tcx>

The minimum width, will be padded according to width/align

§trait: Symbol

The formatting trait used by the argument, e.g. sym::Display for {}, sym::Debug for {:?}.

§trait_span: Option<Span>

Implementations§

Returns true if this format spec is unchanged from the default. e.g. returns true for {}, {foo} and {2}, but false for {:?}, {foo:5} and {3:.5}

Has no other formatting specifiers than setting the format trait. returns true for {}, {foo}, {:?}, but false for {foo:5}, {3:.5?}

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 96 bytes