pub struct FormattingOptions { /* private fields */ }formatting_options)Expand description
Implementationsยง
Sourceยงimpl FormattingOptions
impl FormattingOptions
Sourcepub const fn new() -> FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn new() -> FormattingOptions
formatting_options)Construct a new FormattingOptions representing the plain {} formatting specifier:
- no flags,
- filled with spaces,
- no alignment,
- no width,
- no precision, and
- no
DebugAsHexoutput mode.
Sourcepub const fn sign(&mut self, sign: Option<Sign>) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn sign(&mut self, sign: Option<Sign>) -> &mut FormattingOptions
formatting_options)Sets or removes the sign (the + or the - flag).
+: This is intended for numeric types and indicates that the sign should always be printed. By default only the negative sign of signed values is printed, and the sign of positive or unsigned values is omitted. This flag indicates that the correct sign (+ or -) should always be printed.-: Currently not used
Sourcepub const fn sign_aware_zero_pad(
&mut self,
sign_aware_zero_pad: bool,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn sign_aware_zero_pad( &mut self, sign_aware_zero_pad: bool, ) -> &mut FormattingOptions
formatting_options)Sets or unsets the 0 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 fn alternate(&mut self, alternate: bool) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn alternate(&mut self, alternate: bool) -> &mut FormattingOptions
formatting_options)Sets or unsets the # flag.
This flag indicates that the โalternateโ form of printing should be used. The alternate forms are:
Sourcepub const fn fill(&mut self, fill: char) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn fill(&mut self, fill: char) -> &mut FormattingOptions
formatting_options)Sets the fill character.
The optional fill character and alignment is provided normally in conjunction with the width parameter. This indicates that if the value being formatted is smaller than width some extra characters will be printed around it.
Sourcepub const fn align(
&mut self,
align: Option<Alignment>,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn align( &mut self, align: Option<Alignment>, ) -> &mut FormattingOptions
formatting_options)Sets or removes the alignment.
The alignment specifies how the value being formatted should be positioned if it is smaller than the width of the formatter.
Sourcepub const fn width(&mut self, width: Option<u16>) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn width(&mut self, width: Option<u16>) -> &mut FormattingOptions
formatting_options)Sets or removes the width.
This is a parameter for the โminimum widthโ that the format should take
up. If the valueโs string does not fill up this many characters, then
the padding specified by FormattingOptions::fill/FormattingOptions::align
will be used to take up the required space.
Sourcepub const fn precision(
&mut self,
precision: Option<u16>,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn precision( &mut self, precision: Option<u16>, ) -> &mut FormattingOptions
formatting_options)Sets or removes the precision.
- For non-numeric types, this can be considered a โmaximum widthโ. If the resulting string is longer than this width, then it is truncated down to this many characters and that truncated value is emitted with proper 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 the decimal point should be printed.
Sourcepub const fn debug_as_hex(
&mut self,
debug_as_hex: Option<DebugAsHex>,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn debug_as_hex( &mut self, debug_as_hex: Option<DebugAsHex>, ) -> &mut FormattingOptions
formatting_options)Specifies whether the Debug trait should use lower-/upper-case
hexadecimal or normal integers
Sourcepub const fn get_sign(&self) -> Option<Sign>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_sign(&self) -> Option<Sign>
formatting_options)Returns the current sign (the + or the - flag).
Sourcepub const fn get_sign_aware_zero_pad(&self) -> bool
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_sign_aware_zero_pad(&self) -> bool
formatting_options)Returns the current 0 flag.
Sourcepub const fn get_alternate(&self) -> bool
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_alternate(&self) -> bool
formatting_options)Returns the current # flag.
Sourcepub const fn get_fill(&self) -> char
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_fill(&self) -> char
formatting_options)Returns the current fill character.
Sourcepub const fn get_align(&self) -> Option<Alignment>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_align(&self) -> Option<Alignment>
formatting_options)Returns the current alignment.
Sourcepub const fn get_width(&self) -> Option<u16>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_width(&self) -> Option<u16>
formatting_options)Returns the current width.
Sourcepub const fn get_precision(&self) -> Option<u16>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_precision(&self) -> Option<u16>
formatting_options)Returns the current precision.
Sourcepub const fn get_debug_as_hex(&self) -> Option<DebugAsHex>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_debug_as_hex(&self) -> Option<DebugAsHex>
formatting_options)Returns the current x? or X? flag.
Sourcepub const fn create_formatter<'a>(
self,
write: &'a mut dyn Write,
) -> Formatter<'a>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn create_formatter<'a>( self, write: &'a mut dyn Write, ) -> Formatter<'a>
formatting_options)Creates a Formatter that writes its output to the given Write trait.
You may alternatively use Formatter::new().
Trait Implementationsยง
Sourceยงimpl Clone for FormattingOptions
impl Clone for FormattingOptions
Sourceยงfn clone(&self) -> FormattingOptions
fn clone(&self) -> FormattingOptions
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FormattingOptions
Sourceยงimpl Debug for FormattingOptions
impl Debug for FormattingOptions
Sourceยงimpl Default for FormattingOptions
impl Default for FormattingOptions
Sourceยงfn default() -> FormattingOptions
fn default() -> FormattingOptions
Same as FormattingOptions::new().
impl Eq for FormattingOptions
Sourceยงimpl PartialEq for FormattingOptions
impl PartialEq for FormattingOptions
impl StructuralPartialEq for FormattingOptions
Auto Trait Implementationsยง
impl Freeze for FormattingOptions
impl RefUnwindSafe for FormattingOptions
impl Send for FormattingOptions
impl Sync for FormattingOptions
impl Unpin for FormattingOptions
impl UnsafeUnpin for FormattingOptions
impl UnwindSafe for FormattingOptions
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงfn in_current_span(self) -> Instrumented<Self> โ
fn in_current_span(self) -> Instrumented<Self> โ
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงfn in_current_span(self) -> Instrumented<Self> โ
fn in_current_span(self) -> Instrumented<Self> โ
Sourceยงimpl<D> OwoColorize for D
impl<D> OwoColorize for D
Sourceยงfn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Sourceยงfn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Sourceยงfn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Sourceยงfn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Sourceยงfn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Sourceยงfn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Sourceยงfn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Sourceยงfn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Sourceยงfn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Sourceยงfn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Sourceยงfn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Sourceยงfn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Sourceยงfn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Sourceยงfn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Sourceยงfn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Sourceยงfn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Sourceยงfn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Sourceยงfn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Sourceยงfn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Sourceยงfn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Sourceยงfn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Sourceยงfn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Sourceยงfn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Sourceยงfn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Sourceยงfn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Sourceยงfn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Sourceยงfn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Sourceยงfn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Sourceยงfn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Sourceยงfn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Sourceยงfn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Sourceยงfn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Sourceยงfn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Sourceยงfn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Sourceยงfn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Sourceยงfn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Sourceยงfn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Sourceยงfn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Sourceยงfn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Sourceยงfn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Sourceยงfn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Sourceยงfn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Sourceยงfn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Sourceยงfn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Sourceยงfn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Sourceยงfn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Sourceยงfn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Sourceยงfn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Sourceยงfn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSourceยงfn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more