Struct powerfmt::smart_display::FormatterOptions
source · 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