pub struct FormatterOptions { /* private fields */ }
Expand description
Configuration for formatting.
This struct is obtained from a Formatter
. It provides the same functionality as that of a
reference to a Formatter
. However, it is not possible to construct a Formatter
, which is
necessary for some use cases of SmartDisplay
. FormatterOptions
implements Default
and
has builder methods to alleviate this.
Implementations§
Source§impl FormatterOptions
impl FormatterOptions
Sourcepub fn with_fill(&mut self, c: char) -> &mut Self
pub fn with_fill(&mut self, c: char) -> &mut Self
Sets the fill character to use whenever there is alignment.
Sourcepub fn with_sign_plus(&mut self, b: bool) -> &mut Self
pub fn with_sign_plus(&mut self, b: bool) -> &mut Self
Set whether the +
flag is specified.
Sourcepub fn with_sign_minus(&mut self, b: bool) -> &mut Self
pub fn with_sign_minus(&mut self, b: bool) -> &mut Self
Set whether the -
flag is specified.
Sourcepub fn with_align(&mut self, align: Option<Alignment>) -> &mut Self
pub fn with_align(&mut self, align: Option<Alignment>) -> &mut Self
Set the flag indicating what form of alignment is requested, if any.
Sourcepub fn with_width(&mut self, width: Option<usize>) -> &mut Self
pub fn with_width(&mut self, width: Option<usize>) -> &mut Self
Set the optional integer width that the output should be.
Sourcepub fn with_precision(&mut self, precision: Option<usize>) -> &mut Self
pub fn with_precision(&mut self, precision: Option<usize>) -> &mut Self
Set the optional precision for numeric types. Alternatively, the maximum width for string types.
Sourcepub fn with_alternate(&mut self, b: bool) -> &mut Self
pub fn with_alternate(&mut self, b: bool) -> &mut Self
Set whether the #
flag is specified.
Sourcepub fn with_sign_aware_zero_pad(&mut self, b: bool) -> &mut Self
pub fn with_sign_aware_zero_pad(&mut self, b: bool) -> &mut Self
Set whether the 0
flag is specified.
Source§impl FormatterOptions
impl FormatterOptions
Sourcepub const fn align(&self) -> Option<Alignment>
pub const fn align(&self) -> Option<Alignment>
Flag indicating what form of alignment was requested.
Sourcepub const fn width(&self) -> Option<usize>
pub const fn width(&self) -> Option<usize>
Optionally specified integer width that the output should be.
Sourcepub const fn precision(&self) -> Option<usize>
pub const fn precision(&self) -> Option<usize>
Optionally specified precision for numeric types. Alternatively, the maximum width for string types.
Sourcepub const fn sign_minus(&self) -> bool
pub const fn sign_minus(&self) -> bool
Determines if the -
flag was specified.
Sourcepub const fn sign_aware_zero_pad(&self) -> bool
pub const fn sign_aware_zero_pad(&self) -> bool
Determines if the 0
flag was specified.
Trait Implementations§
Source§impl Clone for FormatterOptions
impl Clone for FormatterOptions
Source§fn clone(&self) -> FormatterOptions
fn clone(&self) -> FormatterOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more