pub struct FormattingOptions {/* private fields */ }formatting_options #118117)Expand description
Implementations§
Source§implFormattingOptions
implFormattingOptions
Sourcepub const fnnew() ->FormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnnew() ->FormattingOptions
formatting_options #118117)Construct a newFormatterBuilder with the suppliedWrite traitobject for output that is equivalent to the{} formattingspecifier:
- no flags,
- filled with spaces,
- no alignment,
- no width,
- no precision, and
- no
DebugAsHexoutput mode.
Sourcepub const fnsign(&mut self, sign:Option<Sign>) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnsign(&mut self, sign:Option<Sign>) -> &mutFormattingOptions
formatting_options #118117)Sets or removes the sign (the+ or the- flag).
+: This is intended for numeric types and indicates that the signshould always be printed. By default only the negative sign of signedvalues is printed, and the sign of positive or unsigned values isomitted. This flag indicates that the correct sign (+ or -) shouldalways be printed.-: Currently not used
Sourcepub const fnsign_aware_zero_pad( &mut self, sign_aware_zero_pad:bool,) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnsign_aware_zero_pad( &mut self, sign_aware_zero_pad:bool,) -> &mutFormattingOptions
formatting_options #118117)Sets or unsets the0 flag.
This is used to indicate for integer formats that the padding to width should both be done with a 0 character as well as be sign-aware
Sourcepub const fnalternate(&mut self, alternate:bool) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnalternate(&mut self, alternate:bool) -> &mutFormattingOptions
formatting_options #118117)Sets or unsets the# flag.
This flag indicates that the “alternate” form of printing should beused. The alternate forms are:
Sourcepub const fnfill(&mut self, fill:char) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnfill(&mut self, fill:char) -> &mutFormattingOptions
formatting_options #118117)Sets the fill character.
The optional fill character and alignment is provided normally inconjunction with the width parameter. This indicates that if the valuebeing formatted is smaller than width some extra characters will beprinted around it.
Sourcepub const fnalign( &mut self, align:Option<Alignment>,) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnalign( &mut self, align:Option<Alignment>,) -> &mutFormattingOptions
formatting_options #118117)Sets or removes the alignment.
The alignment specifies how the value being formatted should bepositioned if it is smaller than the width of the formatter.
Sourcepub const fnwidth(&mut self, width:Option<u16>) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnwidth(&mut self, width:Option<u16>) -> &mutFormattingOptions
formatting_options #118117)Sets or removes the width.
This is a parameter for the “minimum width” that the format should takeup. If the value’s string does not fill up this many characters, thenthe padding specified byFormattingOptions::fill/FormattingOptions::alignwill be used to take up the required space.
Sourcepub const fnprecision( &mut self, precision:Option<u16>,) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnprecision( &mut self, precision:Option<u16>,) -> &mutFormattingOptions
formatting_options #118117)Sets or removes the precision.
- For non-numeric types, this can be considered a “maximum width”. Ifthe resulting string is longer than this width, then it is truncateddown to this many characters and that truncated value is emitted withproper fill, alignment and width if those parameters are set.
- For integral types, this is ignored.
- For floating-point types, this indicates how many digits after thedecimal point should be printed.
Sourcepub const fndebug_as_hex( &mut self, debug_as_hex:Option<DebugAsHex>,) -> &mutFormattingOptions
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fndebug_as_hex( &mut self, debug_as_hex:Option<DebugAsHex>,) -> &mutFormattingOptions
formatting_options #118117)Specifies whether theDebug trait should use lower-/upper-casehexadecimal or normal integers
Sourcepub const fnget_sign(&self) ->Option<Sign>
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_sign(&self) ->Option<Sign>
formatting_options #118117)Returns the current sign (the+ or the- flag).
Sourcepub const fnget_sign_aware_zero_pad(&self) ->bool
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_sign_aware_zero_pad(&self) ->bool
formatting_options #118117)Returns the current0 flag.
Sourcepub const fnget_alternate(&self) ->bool
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_alternate(&self) ->bool
formatting_options #118117)Returns the current# flag.
Sourcepub const fnget_fill(&self) ->char
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_fill(&self) ->char
formatting_options #118117)Returns the current fill character.
Sourcepub const fnget_align(&self) ->Option<Alignment>
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_align(&self) ->Option<Alignment>
formatting_options #118117)Returns the current alignment.
Sourcepub const fnget_width(&self) ->Option<u16>
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_width(&self) ->Option<u16>
formatting_options #118117)Returns the current width.
Sourcepub const fnget_precision(&self) ->Option<u16>
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_precision(&self) ->Option<u16>
formatting_options #118117)Returns the current precision.
Sourcepub const fnget_debug_as_hex(&self) ->Option<DebugAsHex>
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fnget_debug_as_hex(&self) ->Option<DebugAsHex>
formatting_options #118117)Returns the current precision.
Sourcepub const fncreate_formatter<'a>( self, write: &'a mut dynWrite,) ->Formatter<'a>
🔬This is a nightly-only experimental API. (formatting_options #118117)
pub const fncreate_formatter<'a>( self, write: &'a mut dynWrite,) ->Formatter<'a>
formatting_options #118117)Creates aFormatter that writes its output to the givenWrite trait.
You may alternatively useFormatter::new().
Trait Implementations§
Source§implClone forFormattingOptions
implClone forFormattingOptions
Source§fnclone(&self) ->FormattingOptions
fnclone(&self) ->FormattingOptions
1.0.0 ·Source§fnclone_from(&mut self, source: &Self)
fnclone_from(&mut self, source: &Self)
source.Read moreSource§implDebug forFormattingOptions
implDebug forFormattingOptions
Source§implDefault forFormattingOptions
implDefault forFormattingOptions
Source§fndefault() ->FormattingOptions
fndefault() ->FormattingOptions
Same asFormattingOptions::new().