Struct powerfmt::smart_display::FormatterOptions
source · pub struct FormatterOptions {
flags: u8,
fill: char,
align: Option<Alignment>,
width: MaybeUninit<usize>,
precision: MaybeUninit<usize>,
}
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.
Fields§
§flags: u8
§fill: char
§align: Option<Alignment>
§width: MaybeUninit<usize>
§precision: MaybeUninit<usize>
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 moresource§impl Debug for FormatterOptions
impl Debug for FormatterOptions
source§impl Default for FormatterOptions
impl Default for FormatterOptions
source§impl From<&Formatter<'_>> for FormatterOptions
impl From<&Formatter<'_>> for FormatterOptions
source§impl From<&mut Formatter<'_>> for FormatterOptions
impl From<&mut Formatter<'_>> for FormatterOptions
impl Copy for FormatterOptions
Auto Trait Implementations§
impl Freeze for FormatterOptions
impl RefUnwindSafe for FormatterOptions
impl Send for FormatterOptions
impl Sync for FormatterOptions
impl Unpin for FormatterOptions
impl UnwindSafe for FormatterOptions
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)