pub struct FormattingOptions {
flags: u32,
width: u16,
precision: u16,
}formatting_options)Expand description
Fieldsยง
ยงflags: u32formatting_options)width: u16formatting_options)precision: u16formatting_options)Implementationsยง
Sourceยงimpl FormattingOptions
impl FormattingOptions
Sourcepub const fn new() -> FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn new() -> FormattingOptions
formatting_options)Construct a new FormatterBuilder with the supplied Write trait
object for output that is equivalent to the {} formatting
specifier:
- no flags,
- filled with spaces,
- no alignment,
- no width,
- no precision, and
- no
DebugAsHexoutput mode.
Sourcepub const fn sign(&mut self, sign: Option<Sign>) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn sign(&mut self, sign: Option<Sign>) -> &mut FormattingOptions
formatting_options)Sets or removes the sign (the + or the - flag).
+: This is intended for numeric types and indicates that the sign should always be printed. By default only the negative sign of signed values is printed, and the sign of positive or unsigned values is omitted. This flag indicates that the correct sign (+ or -) should always be printed.-: Currently not used
Sourcepub const fn sign_aware_zero_pad(
&mut self,
sign_aware_zero_pad: bool,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn sign_aware_zero_pad( &mut self, sign_aware_zero_pad: bool, ) -> &mut FormattingOptions
formatting_options)Sets or unsets the 0 flag.
This is used to indicate for integer formats that the padding to width should both be done with a 0 character as well as be sign-aware
Sourcepub const fn alternate(&mut self, alternate: bool) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn alternate(&mut self, alternate: bool) -> &mut FormattingOptions
formatting_options)Sets or unsets the # flag.
This flag indicates that the โalternateโ form of printing should be used. The alternate forms are:
Sourcepub const fn fill(&mut self, fill: char) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn fill(&mut self, fill: char) -> &mut FormattingOptions
formatting_options)Sets the fill character.
The optional fill character and alignment is provided normally in conjunction with the width parameter. This indicates that if the value being formatted is smaller than width some extra characters will be printed around it.
Sourcepub const fn align(
&mut self,
align: Option<Alignment>,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn align( &mut self, align: Option<Alignment>, ) -> &mut FormattingOptions
formatting_options)Sets or removes the alignment.
The alignment specifies how the value being formatted should be positioned if it is smaller than the width of the formatter.
Sourcepub const fn width(&mut self, width: Option<u16>) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn width(&mut self, width: Option<u16>) -> &mut FormattingOptions
formatting_options)Sets or removes the width.
This is a parameter for the โminimum widthโ that the format should take
up. If the valueโs string does not fill up this many characters, then
the padding specified by FormattingOptions::fill/FormattingOptions::align
will be used to take up the required space.
Sourcepub const fn precision(
&mut self,
precision: Option<u16>,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn precision( &mut self, precision: Option<u16>, ) -> &mut FormattingOptions
formatting_options)Sets or removes the precision.
- For non-numeric types, this can be considered a โmaximum widthโ. If the resulting string is longer than this width, then it is truncated down to this many characters and that truncated value is emitted with proper fill, alignment and width if those parameters are set.
- For integral types, this is ignored.
- For floating-point types, this indicates how many digits after the decimal point should be printed.
Sourcepub const fn debug_as_hex(
&mut self,
debug_as_hex: Option<DebugAsHex>,
) -> &mut FormattingOptions
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn debug_as_hex( &mut self, debug_as_hex: Option<DebugAsHex>, ) -> &mut FormattingOptions
formatting_options)Specifies whether the Debug trait should use lower-/upper-case
hexadecimal or normal integers
Sourcepub const fn get_sign(&self) -> Option<Sign>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_sign(&self) -> Option<Sign>
formatting_options)Returns the current sign (the + or the - flag).
Sourcepub const fn get_sign_aware_zero_pad(&self) -> bool
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_sign_aware_zero_pad(&self) -> bool
formatting_options)Returns the current 0 flag.
Sourcepub const fn get_alternate(&self) -> bool
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_alternate(&self) -> bool
formatting_options)Returns the current # flag.
Sourcepub const fn get_fill(&self) -> char
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_fill(&self) -> char
formatting_options)Returns the current fill character.
Sourcepub const fn get_align(&self) -> Option<Alignment>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_align(&self) -> Option<Alignment>
formatting_options)Returns the current alignment.
Sourcepub const fn get_width(&self) -> Option<u16>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_width(&self) -> Option<u16>
formatting_options)Returns the current width.
Sourcepub const fn get_precision(&self) -> Option<u16>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_precision(&self) -> Option<u16>
formatting_options)Returns the current precision.
Sourcepub const fn get_debug_as_hex(&self) -> Option<DebugAsHex>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn get_debug_as_hex(&self) -> Option<DebugAsHex>
formatting_options)Returns the current precision.
Sourcepub const fn create_formatter<'a>(
self,
write: &'a mut dyn Write,
) -> Formatter<'a>
๐ฌThis is a nightly-only experimental API. (formatting_options)
pub const fn create_formatter<'a>( self, write: &'a mut dyn Write, ) -> Formatter<'a>
formatting_options)Creates a Formatter that writes its output to the given Write trait.
You may alternatively use Formatter::new().
Trait Implementationsยง
Sourceยงimpl Clone for FormattingOptions
impl Clone for FormattingOptions
Sourceยงfn clone(&self) -> FormattingOptions
fn clone(&self) -> FormattingOptions
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl Debug for FormattingOptions
impl Debug for FormattingOptions
Sourceยงimpl Default for FormattingOptions
impl Default for FormattingOptions
Sourceยงfn default() -> FormattingOptions
fn default() -> FormattingOptions
Same as FormattingOptions::new().
Sourceยงimpl PartialEq for FormattingOptions
impl PartialEq for FormattingOptions
Sourceยงfn eq(&self, other: &FormattingOptions) -> bool
fn eq(&self, other: &FormattingOptions) -> bool
self and other values to be equal, and is used by ==.impl Copy for FormattingOptions
impl Eq for FormattingOptions
impl StructuralPartialEq for FormattingOptions
Auto Trait Implementationsยง
impl Freeze for FormattingOptions
impl RefUnwindSafe for FormattingOptions
impl Send for FormattingOptions
impl Sync for FormattingOptions
impl Unpin for FormattingOptions
impl UnsafeUnpin for FormattingOptions
impl UnwindSafe for FormattingOptions
Blanket Implementationsยง
Sourceยงimpl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Sourceยงimpl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Sourceยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Sourceยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Sourceยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Anyโs vtable from &Traitโs.Sourceยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Anyโs vtable from &mut Traitโs.Sourceยงimpl<T> DowncastSend for T
impl<T> DowncastSend for T
Sourceยงimpl<T> DowncastSync for T
impl<T> DowncastSync for T
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Sourceยงimpl<T> FmtForward for T
impl<T> FmtForward for T
Sourceยงfn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Sourceยงfn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Sourceยงfn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Sourceยงfn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Sourceยงfn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Sourceยงfn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Sourceยงfn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Sourceยงfn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงfn in_current_span(self) -> Instrumented<Self> โ
fn in_current_span(self) -> Instrumented<Self> โ
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self> โ
fn into_either(self, into_left: bool) -> Either<Self, Self> โ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงimpl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Sourceยงfn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Sourceยงfn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSourceยงfn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSourceยงfn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Sourceยงfn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Sourceยงfn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Sourceยงfn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Sourceยงfn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Sourceยงimpl<T> PossiblyOption<T> for T
impl<T> PossiblyOption<T> for T
Sourceยงimpl<T> Tap for T
impl<T> Tap for T
Sourceยงfn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSourceยงfn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSourceยงfn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSourceยงfn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSourceยงfn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSourceยงfn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSourceยงfn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Sourceยงfn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Sourceยงfn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Sourceยงfn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Sourceยงfn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Sourceยงfn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Sourceยงfn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.