powerfmt::smart_display

Struct 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

Source

pub fn with_fill(&mut self, c: char) -> &mut Self

Sets the fill character to use whenever there is alignment.

Source

pub fn with_sign_plus(&mut self, b: bool) -> &mut Self

Set whether the + flag is specified.

Source

pub fn with_sign_minus(&mut self, b: bool) -> &mut Self

Set whether the - flag is specified.

Source

pub fn with_align(&mut self, align: Option<Alignment>) -> &mut Self

Set the flag indicating what form of alignment is requested, if any.

Source

pub fn with_width(&mut self, width: Option<usize>) -> &mut Self

Set the optional integer width that the output should be.

Source

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.

Source

pub fn with_alternate(&mut self, b: bool) -> &mut Self

Set whether the # flag is specified.

Source

pub fn with_sign_aware_zero_pad(&mut self, b: bool) -> &mut Self

Set whether the 0 flag is specified.

Source§

impl FormatterOptions

Source

pub const fn fill(&self) -> char

Character used as ‘fill’ whenever there is alignment.

Source

pub const fn align(&self) -> Option<Alignment>

Flag indicating what form of alignment was requested.

Source

pub const fn width(&self) -> Option<usize>

Optionally specified integer width that the output should be.

Source

pub const fn precision(&self) -> Option<usize>

Optionally specified precision for numeric types. Alternatively, the maximum width for string types.

Source

pub const fn sign_plus(&self) -> bool

Determines if the + flag was specified.

Source

pub const fn sign_minus(&self) -> bool

Determines if the - flag was specified.

Source

pub const fn alternate(&self) -> bool

Determines if the # flag was specified.

Source

pub const fn sign_aware_zero_pad(&self) -> bool

Determines if the 0 flag was specified.

Trait Implementations§

Source§

impl Clone for FormatterOptions

Source§

fn clone(&self) -> FormatterOptions

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FormatterOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FormatterOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&Formatter<'_>> for FormatterOptions

Source§

fn from(value: &Formatter<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<&mut Formatter<'_>> for FormatterOptions

Source§

fn from(value: &mut Formatter<'_>) -> Self

Converts to this type from the input type.
Source§

impl Copy for FormatterOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SizedTypeProperties for T

Source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)] const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Printable for T
where T: Copy + Debug,