Struct dynfmt::ArgumentSpec[][src]

pub struct ArgumentSpec<'a> { /* fields omitted */ }

The format specification for a single argument in the format string, created by Format::iter_args.

The argument spec may borrow data from the format string, e.g. when referring to named arguments in the argument list.


impl<'a> ArgumentSpec<'a>[src]

pub fn new(start: usize, end: usize) -> Self[src]

Creates a new argument specification with default values.

The start and end parameters denote the exclusive range of this specification in the format string. E.g. for a format string "{}", the range is [0, 2).

pub fn with_position(self, position: Position<'a>) -> Self[src]

Sets the argument position. Defaults to Position::Auto.

pub fn with_format(self, format: FormatType) -> Self[src]

Sets the formatting type. Defaults to FormatType::Display.

pub fn with_alternate(self, alternate: bool) -> Self[src]

Switch the formatter to alternate mode.

pub fn with_sign(self, sign: bool) -> Self[src]

Always print a sign characters in front of numbers.

pub fn with_zeros(self, pad_zero: bool) -> Self[src]

Activate sign-aware zero padding.

pub fn with_fill(self, fill_char: char) -> Self[src]

Set the fill character. Defaults to ' ' (a space).

pub fn with_alignment(self, alignment: Alignment) -> Self[src]

Set alignment within the width of this format. Defaults to Alignment::Right.

pub fn with_width(self, width: Option<Count<'a>>) -> Self[src]

Set a minimum width for this argument. Defaults to None.

If the formatted argument is smaller than the threshold, the argument is padded with the fill character. If the argument is numeric and with_zeros is specified, it is padded with zeros instead.

pub fn with_precision(self, precision: Option<Count<'a>>) -> Self[src]

Set the precision for floating point values. Defaults to arbitrary precision.

pub fn start(&self) -> usize[src]

The start index of this specification in the format string.

pub fn end(&self) -> usize[src]

The end index of this specification in the format string.

Trait Implementations

impl<'a> Debug for ArgumentSpec<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for ArgumentSpec<'a>

impl<'a> Send for ArgumentSpec<'a>

impl<'a> Sync for ArgumentSpec<'a>

impl<'a> Unpin for ArgumentSpec<'a>

impl<'a> UnwindSafe for ArgumentSpec<'a>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.