Skip to main content

NfOptions

Struct NfOptions 

Source
pub struct NfOptions {
Show 22 fields pub locale: String, pub style: Style, pub currency: String, pub currency_display: u8, pub unit: String, pub unit_display: u8, pub notation: Notation, pub compact_long: bool, pub sign: SignDisplay, pub grouping: Grouping, pub min_int: usize, pub min_frac: usize, pub max_frac: usize, pub min_sig: usize, pub max_sig: usize, pub compact_round: bool, pub rounding_mode: RoundingMode, pub rounding_increment: u32, pub rounding_priority: u8, pub strip_if_integer: bool, pub numbering_system: String, pub accounting: bool,
}
Expand description

書式の設定(Intl.NumberFormat の解決済みオプション)。

Fields§

§locale: String

解決したロケール(en-US など)。

§style: Style§currency: String

通貨コード(大文字 3 文字)。

§currency_display: u8

0: symbol・1: narrowSymbol・2: code・3: name。

§unit: String§unit_display: u8

0: short・1: narrow・2: long。

§notation: Notation§compact_long: bool§sign: SignDisplay§grouping: Grouping§min_int: usize§min_frac: usize§max_frac: usize§min_sig: usize

有効桁数で丸めるとき(max_sig > 0)。

§max_sig: usize§compact_round: bool

コンパクト表記の既定の丸め(桁数の指定が無いとき)。

§rounding_mode: RoundingMode§rounding_increment: u32

丸めの増分(1・2・5・10・…・5000)。

§rounding_priority: u8

0: auto・1: morePrecision・2: lessPrecision(小数桁と有効桁の両方で丸めて選ぶ)。

§strip_if_integer: bool

trailingZeroDisplay: "stripIfInteger"。

§numbering_system: String

数字の体系(latn・arab など)。

§accounting: bool

currencySign: "accounting"(負の数を括弧で囲む)。

Implementations§

Source§

impl NfOptions

Source

pub fn new(locale: &str) -> Self

Source

pub fn resolve_digits(&mut self, d: DigitOpts) -> Result<(), &'static str>

桁数のオプションを解決する(仕様の SetNumberFormatDigitOptions)。範囲の誤りは Err(メッセージ)(RangeError)。

Source

pub fn resolve_digits_full( &mut self, d: DigitOpts, priority: u8, increment: u32, ) -> Result<(), (bool, &'static str)>

丸めの優先度(0: auto・1: morePrecision・2: lessPrecision)と増分を含めた桁数の解決 (仕様の SetNumberFormatDigitOptions)。Err((true, _)) は TypeError、Err((false, _)) は RangeError。

Trait Implementations§

Source§

impl Clone for NfOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NfOptions

Source§

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

Formats the value using the given formatter. Read more

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_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§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.