Struct clippy_utils::macros::FormatSpec
source · 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§
source§impl<'tcx> FormatSpec<'tcx>
impl<'tcx> FormatSpec<'tcx>
fn new(
spec: FormatSpec<'_>,
positions: ParamPosition,
values: &FormatArgsValues<'tcx>
) -> Option<Self>
sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
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}
sourcepub fn is_default_for_trait(&self) -> bool
pub fn is_default_for_trait(&self) -> bool
Has no other formatting specifiers than setting the format trait. returns true for {}
,
{foo}
, {:?}
, but false for {foo:5}
, {3:.5?}
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> RefUnwindSafe for FormatSpec<'tcx>
impl<'tcx> !Send for FormatSpec<'tcx>
impl<'tcx> !Sync for FormatSpec<'tcx>
impl<'tcx> Unpin for FormatSpec<'tcx>
impl<'tcx> UnwindSafe for FormatSpec<'tcx>
Blanket Implementations§
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