Movatterモバイル変換


[0]ホーム

URL:


FormattingOptions

std::fmt

StructFormattingOptions 

Source
pub struct FormattingOptions {/* private fields */ }
🔬This is a nightly-only experimental API. (formatting_options #118117)
Expand description

Options for formatting.

FormattingOptions is aFormatter without an attachedWrite trait.It is mainly used to constructFormatter instances.

Implementations§

Source§

implFormattingOptions

Source

pub const fnnew() ->FormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Construct a newFormatterBuilder with the suppliedWrite traitobject for output that is equivalent to the{} formattingspecifier:

  • no flags,
  • filled with spaces,
  • no alignment,
  • no width,
  • no precision, and
  • noDebugAsHex output mode.
Source

pub const fnsign(&mut self, sign:Option<Sign>) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Sets or removes the sign (the+ or the- flag).

  • +: This is intended for numeric types and indicates that the signshould always be printed. By default only the negative sign of signedvalues is printed, and the sign of positive or unsigned values isomitted. This flag indicates that the correct sign (+ or -) shouldalways be printed.
  • -: Currently not used
Source

pub const fnsign_aware_zero_pad( &mut self, sign_aware_zero_pad:bool,) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Sets or unsets the0 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

Source

pub const fnalternate(&mut self, alternate:bool) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Sets or unsets the# flag.

This flag indicates that the “alternate” form of printing should beused. The alternate forms are:

  • Debug : pretty-print theDebug formatting (adds linebreaks and indentation)
  • LowerHex as well asUpperHex - precedes the argument with a0x
  • Octal - precedes the argument with a0o
  • Binary - precedes the argument with a0b
Source

pub const fnfill(&mut self, fill:char) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Sets the fill character.

The optional fill character and alignment is provided normally inconjunction with the width parameter. This indicates that if the valuebeing formatted is smaller than width some extra characters will beprinted around it.

Source

pub const fnalign( &mut self, align:Option<Alignment>,) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Sets or removes the alignment.

The alignment specifies how the value being formatted should bepositioned if it is smaller than the width of the formatter.

Source

pub const fnwidth(&mut self, width:Option<u16>) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Sets or removes the width.

This is a parameter for the “minimum width” that the format should takeup. If the value’s string does not fill up this many characters, thenthe padding specified byFormattingOptions::fill/FormattingOptions::alignwill be used to take up the required space.

Source

pub const fnprecision( &mut self, precision:Option<u16>,) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Sets or removes the precision.

  • For non-numeric types, this can be considered a “maximum width”. Ifthe resulting string is longer than this width, then it is truncateddown to this many characters and that truncated value is emitted withproper 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 thedecimal point should be printed.
Source

pub const fndebug_as_hex( &mut self, debug_as_hex:Option<DebugAsHex>,) -> &mutFormattingOptions

🔬This is a nightly-only experimental API. (formatting_options #118117)

Specifies whether theDebug trait should use lower-/upper-casehexadecimal or normal integers

Source

pub const fnget_sign(&self) ->Option<Sign>

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current sign (the+ or the- flag).

Source

pub const fnget_sign_aware_zero_pad(&self) ->bool

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current0 flag.

Source

pub const fnget_alternate(&self) ->bool

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current# flag.

Source

pub const fnget_fill(&self) ->char

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current fill character.

Source

pub const fnget_align(&self) ->Option<Alignment>

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current alignment.

Source

pub const fnget_width(&self) ->Option<u16>

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current width.

Source

pub const fnget_precision(&self) ->Option<u16>

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current precision.

Source

pub const fnget_debug_as_hex(&self) ->Option<DebugAsHex>

🔬This is a nightly-only experimental API. (formatting_options #118117)

Returns the current precision.

Source

pub const fncreate_formatter<'a>( self, write: &'a mut dynWrite,) ->Formatter<'a>

🔬This is a nightly-only experimental API. (formatting_options #118117)

Creates aFormatter that writes its output to the givenWrite trait.

You may alternatively useFormatter::new().

Trait Implementations§

Source§

implClone forFormattingOptions

Source§

fnclone(&self) ->FormattingOptions

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

fnclone_from(&mut self, source: &Self)

Performs copy-assignment fromsource.Read more
Source§

implDebug forFormattingOptions

Source§

fnfmt(&self, f: &mutFormatter<'_>) ->Result<(),Error>

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

implDefault forFormattingOptions

Source§

implPartialEq forFormattingOptions

Source§

fneq(&self, other: &FormattingOptions) ->bool

Tests forself andother values to be equal, and is used by==.
1.0.0 ·Source§

fnne(&self, other:&Rhs) ->bool

Tests for!=. The default implementation is almost always sufficient,and should not be overridden without very good reason.
Source§

implCopy forFormattingOptions

Source§

implEq forFormattingOptions

Source§

implStructuralPartialEq forFormattingOptions

Auto Trait Implementations§

§

implFreeze forFormattingOptions

§

implRefUnwindSafe forFormattingOptions

§

implSend forFormattingOptions

§

implSync forFormattingOptions

§

implUnpin forFormattingOptions

§

implUnwindSafe forFormattingOptions

Blanket Implementations§

Source§

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

Source§

fntype_id(&self) ->TypeId

Gets theTypeId ofself.Read more
Source§

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

Source§

fnborrow(&self) ->&T

Immutably borrows from an owned value.Read more
Source§

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

Source§

fnborrow_mut(&mut self) ->&mut T

Mutably borrows from an owned value.Read more
Source§

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

Source§

unsafe fnclone_to_uninit(&self, dest:*mutu8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment fromself todest.Read more
Source§

impl<T>From<T> for T

Source§

fnfrom(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fninto(self) -> U

CallsU::from(self).

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

Source§

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

Source§

typeOwned = T

The resulting type after obtaining ownership.
Source§

fnto_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning.Read more
Source§

fnclone_into(&self, target:&mut T)

Uses borrowed data to replace owned data, usually by cloning.Read more
Source§

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

Source§

typeError =Infallible

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

fntry_from(value: U) ->Result<T, <T asTryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

typeError = <U asTryFrom<T>>::Error

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

fntry_into(self) ->Result<U, <U asTryFrom<T>>::Error>

Performs the conversion.

[8]ページ先頭

©2009-2025 Movatter.jp