pub struct FormattingOptions { /* private fields */ }
formatting_options #118117)
Options for formatting.
FormattingOptions is a Formatter without an attached Write trait. It is mainly used to construct Formatter instances.
impl FormattingOptions
pub const fn new() -> FormattingOptions
formatting_options #118117)
Construct a new FormatterBuilder with the supplied Write trait object for output that is equivalent to the {} formatting specifier:
DebugAsHex output mode.pub const fn sign(&mut self, sign: Option<Sign>) -> &mut FormattingOptions
formatting_options #118117)
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 usedpub const fn sign_aware_zero_pad(
&mut self,
sign_aware_zero_pad: bool,
) -> &mut FormattingOptionsformatting_options #118117)
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
pub const fn alternate(&mut self, alternate: bool) -> &mut FormattingOptions
formatting_options #118117)
Sets or unsets the # flag.
This flag indicates that the “alternate” form of printing should be used. The alternate forms are:
pub const fn fill(&mut self, fill: char) -> &mut FormattingOptions
formatting_options #118117)
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.
pub const fn align(
&mut self,
align: Option<Alignment>,
) -> &mut FormattingOptionsformatting_options #118117)
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.
pub const fn width(&mut self, width: Option<u16>) -> &mut FormattingOptions
formatting_options #118117)
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.
pub const fn precision(
&mut self,
precision: Option<u16>,
) -> &mut FormattingOptionsformatting_options #118117)
Sets or removes the precision.
pub const fn debug_as_hex(
&mut self,
debug_as_hex: Option<DebugAsHex>,
) -> &mut FormattingOptionsformatting_options #118117)
Specifies whether the Debug trait should use lower-/upper-case hexadecimal or normal integers
pub const fn get_sign(&self) -> Option<Sign>
formatting_options #118117)
Returns the current sign (the + or the - flag).
pub const fn get_sign_aware_zero_pad(&self) -> bool
formatting_options #118117)
Returns the current 0 flag.
pub const fn get_alternate(&self) -> bool
formatting_options #118117)
Returns the current # flag.
pub const fn get_fill(&self) -> char
formatting_options #118117)
Returns the current fill character.
pub const fn get_align(&self) -> Option<Alignment>
formatting_options #118117)
Returns the current alignment.
pub const fn get_width(&self) -> Option<u16>
formatting_options #118117)
Returns the current width.
pub const fn get_precision(&self) -> Option<u16>
formatting_options #118117)
Returns the current precision.
pub const fn get_debug_as_hex(&self) -> Option<DebugAsHex>
formatting_options #118117)
Returns the current precision.
pub const fn create_formatter<'a>(
self,
write: &'a mut dyn Write,
) -> Formatter<'a>formatting_options #118117)
Creates a Formatter that writes its output to the given Write trait.
You may alternatively use Formatter::new().
impl Clone for FormattingOptions
fn clone(&self) -> FormattingOptions
fn clone_from(&mut self, source: &Self)
source. Read more
impl Debug for FormattingOptions
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
impl Default for FormattingOptions
fn default() -> FormattingOptions
Same as FormattingOptions::new().
impl PartialEq for FormattingOptions
fn eq(&self, other: &FormattingOptions) -> bool
self and other values to be equal, and is used by ==.fn ne(&self, other: &Rhs) -> bool
!=. The default implementation is almost always sufficient, and should not be overridden without very good reason.impl Copy for FormattingOptions
impl Eq for FormattingOptions
impl StructuralPartialEq for FormattingOptions
impl Freeze for FormattingOptions
impl RefUnwindSafe for FormattingOptions
impl Send for FormattingOptions
impl Sync for FormattingOptions
impl Unpin for FormattingOptions
impl UnwindSafe for FormattingOptions
impl<T> Any for Twhere
T: 'static + ?Sized,impl<T> Borrow<T> for Twhere
T: ?Sized,impl<T> BorrowMut<T> for Twhere
T: ?Sized,impl<T> CloneToUninit for Twhere
T: Clone,unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit #126799)
impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for Twhere
U: From<T>,fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<T> ToOwned for Twhere
T: Clone,type Owned = T
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/fmt/struct.FormattingOptions.html