Struct FormatterOptions
pub struct FormatterOptions { /* private fields */ }
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
impl FormatterOptions
fn with_fill(&mut self, c: char) -> &mut SelfSets the fill character to use whenever there is alignment.
fn with_sign_plus(&mut self, b: bool) -> &mut SelfSet whether the
+flag is specified.fn with_sign_minus(&mut self, b: bool) -> &mut SelfSet whether the
-flag is specified.fn with_align(&mut self, align: Option<Alignment>) -> &mut SelfSet the flag indicating what form of alignment is requested, if any.
fn with_width(&mut self, width: Option<usize>) -> &mut SelfSet the optional integer width that the output should be.
fn with_precision(&mut self, precision: Option<usize>) -> &mut SelfSet the optional precision for numeric types. Alternatively, the maximum width for string types.
fn with_alternate(&mut self, b: bool) -> &mut SelfSet whether the
#flag is specified.fn with_sign_aware_zero_pad(&mut self, b: bool) -> &mut SelfSet whether the
0flag is specified.
impl FormatterOptions
const fn fill(&self) -> charCharacter used as 'fill' whenever there is alignment.
const fn align(&self) -> Option<Alignment>Flag indicating what form of alignment was requested.
const fn width(&self) -> Option<usize>Optionally specified integer width that the output should be.
const fn precision(&self) -> Option<usize>Optionally specified precision for numeric types. Alternatively, the maximum width for string types.
const fn sign_plus(&self) -> boolDetermines if the
+flag was specified.const fn sign_minus(&self) -> boolDetermines if the
-flag was specified.const fn alternate(&self) -> boolDetermines if the
#flag was specified.const fn sign_aware_zero_pad(&self) -> boolDetermines if the
0flag was specified.
Trait Implementations
impl Clone for FormatterOptions
fn clone(&self) -> FormatterOptions
impl Copy for FormatterOptions
impl Debug for FormatterOptions
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for FormatterOptions
fn default() -> Self
impl From<&Formatter<'_>> for FormatterOptions
fn from(value: &Formatter<'_>) -> Self
impl From<&mut Formatter<'_>> for FormatterOptions
fn from(value: &mut Formatter<'_>) -> Self
Auto Trait Implementations
impl Freeze for FormatterOptions
impl RefUnwindSafe for FormatterOptions
impl Send for FormatterOptions
impl Sync for FormatterOptions
impl Unpin for FormatterOptions
impl UnsafeUnpin for FormatterOptions
impl UnwindSafe for FormatterOptions
Blanket Implementations
impl<T> Any for FormatterOptions
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for FormatterOptions
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for FormatterOptions
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for FormatterOptions
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for FormatterOptions
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for FormatterOptions
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for FormatterOptions
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for FormatterOptions
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>