Struct FormatterOptions

struct FormatterOptions { ... }

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(self: &mut Self, c: char) -> &mut Self

Sets the fill character to use whenever there is alignment.

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

Set whether the + flag is specified.

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

Set whether the - flag is specified.

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

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

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

Set the optional integer width that the output should be.

fn with_precision(self: &mut Self, precision: Option<usize>) -> &mut Self

Set the optional precision for numeric types. Alternatively, the maximum width for string types.

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

Set whether the # flag is specified.

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

Set whether the 0 flag is specified.

impl FormatterOptions

const fn fill(self: &Self) -> char

Character used as 'fill' whenever there is alignment.

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

Flag indicating what form of alignment was requested.

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

Optionally specified integer width that the output should be.

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

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

const fn sign_plus(self: &Self) -> bool

Determines if the + flag was specified.

const fn sign_minus(self: &Self) -> bool

Determines if the - flag was specified.

const fn alternate(self: &Self) -> bool

Determines if the # flag was specified.

const fn sign_aware_zero_pad(self: &Self) -> bool

Determines if the 0 flag was specified.

impl Clone for FormatterOptions

fn clone(self: &Self) -> FormatterOptions

impl Copy for FormatterOptions

impl Debug for FormatterOptions

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

impl Default for FormatterOptions

fn default() -> Self

impl Freeze for FormatterOptions

impl From for FormatterOptions

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

impl From for FormatterOptions

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

impl RefUnwindSafe for FormatterOptions

impl Send for FormatterOptions

impl Sync for FormatterOptions

impl Unpin for FormatterOptions

impl UnsafeUnpin for FormatterOptions

impl UnwindSafe for FormatterOptions

impl<T> Any for FormatterOptions

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for FormatterOptions

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for FormatterOptions

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

impl<T> CloneToUninit for FormatterOptions

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

impl<T> From for FormatterOptions

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for FormatterOptions

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for FormatterOptions

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

impl<T, U> TryInto for FormatterOptions

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