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 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
)