Struct NumberFormat

#[repr(transparent)]
pub struct NumberFormat { /* private fields */ }

The Intl.NumberFormat object is a constructor for objects that enable language sensitive number formatting.

MDN documentation

Implementations

impl NumberFormat

fn format_range(&self, start: &JsString, end: &JsString) -> Result<JsString, JsValue>

Formats a range of numbers according to the locale and formatting options of this Intl.NumberFormat object.

Accepts numeric strings for BigInt/arbitrary precision (e.g., "123n" → "123", or use E notation: "1000000E-6" → "1").

Throws a TypeError if the values are invalid.

MDN documentation

impl NumberFormat

fn supported_locales_of(locales: &Array, options: &Object) -> Array

The Intl.NumberFormat.supportedLocalesOf() method returns an array containing those of the provided locales that are supported in number formatting without having to fall back to the runtime's default locale.

MDN documentation

impl NumberFormat

fn format(&self) -> Function

The Intl.NumberFormat.prototype.format property returns a getter function that formats a number according to the locale and formatting options of this NumberFormat object.

MDN documentation

impl NumberFormat

fn format_range_to_parts(&self, start: &JsString, end: &JsString) -> Result<Array<NumberRangeFormatPart>, JsValue>

Returns an array of locale-specific tokens representing each part of the formatted number range.

Accepts numeric strings for BigInt/arbitrary precision (e.g., "123n" → "123", or use E notation: "1000000E-6" → "1").

Throws a TypeError if the values are invalid.

MDN documentation

impl NumberFormat

fn format_to_parts(&self, number: f64) -> Array

The Intl.Numberformat.prototype.formatToParts() method allows locale-aware formatting of strings produced by NumberTimeFormat formatters.

MDN documentation

impl NumberFormat

fn resolved_options(&self) -> Object

The Intl.NumberFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the locale and number formatting options computed during initialization of this NumberFormat object.

MDN documentation

impl NumberFormat

fn new(locales: &Array, options: &Object) -> NumberFormat

The Intl.NumberFormat object is a constructor for objects that enable language sensitive number formatting.

MDN documentation

Trait Implementations

impl AsRef<JsValue> for NumberFormat

fn as_ref(&self) -> &JsValue

impl AsRef<NumberFormat> for NumberFormat

fn as_ref(&self) -> &NumberFormat

impl AsRef<Object> for NumberFormat

fn as_ref(&self) -> &Object

impl Clone for NumberFormat

fn clone(&self) -> Self

impl Debug for NumberFormat

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

impl Default for NumberFormat

fn default() -> Self

impl Deref for NumberFormat

type Target = Object;
fn deref(&self) -> &Object

impl ErasableGeneric for NumberFormat

type Repr = JsValue;

impl From<JsValue> for NumberFormat

fn from(obj: JsValue) -> Self

impl FromWasmAbi for NumberFormat

type Abi = <JsValue as FromWasmAbi>::Abi;
unsafe fn from_abi(js: Self::Abi) -> Self

impl IntoJsGeneric for NumberFormat where NumberFormat: JsGeneric,

type JsCanon = NumberFormat;
fn to_js(self) -> NumberFormat

impl IntoWasmAbi for NumberFormat

type Abi = <JsValue as IntoWasmAbi>::Abi;
fn into_abi(self) -> Self::Abi

impl JsCast for NumberFormat

fn instanceof(val: &JsValue) -> bool
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self

impl LongRefFromWasmAbi for NumberFormat

type Abi = <JsValue as LongRefFromWasmAbi>::Abi;
type Anchor = NumberFormat;
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

impl OptionFromWasmAbi for NumberFormat

fn is_none(abi: &Self::Abi) -> bool

impl OptionIntoWasmAbi for NumberFormat

fn none() -> Self::Abi

impl Promising for NumberFormat

type Resolution = NumberFormat;

impl RefFromWasmAbi for NumberFormat

type Abi = <JsValue as RefFromWasmAbi>::Abi;
type Anchor = ManuallyDrop<NumberFormat>;
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

impl UpcastFrom<NumberFormat> for NumberFormat

impl WasmDescribe for NumberFormat

fn describe()

Auto Trait Implementations

impl Freeze for NumberFormat

impl RefUnwindSafe for NumberFormat

impl Send for NumberFormat

impl Sync for NumberFormat

impl Unpin for NumberFormat

impl UnsafeUnpin for NumberFormat

impl UnwindSafe for NumberFormat

Blanket Implementations

impl<P, T> Receiver for NumberFormat where P: Deref<Target = T> + ?Sized, T: ?Sized,

impl<S, T> Upcast<T> for NumberFormat where T: UpcastFrom<S> + ?Sized, S: ?Sized,

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

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

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

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

impl<T> From<T> for NumberFormat

impl<T> JsGeneric for NumberFormat where T: ErasableGeneric<Repr = JsValue> + UpcastFrom<T> + Upcast<JsValue> + JsCast + 'static,

impl<T> ReturnWasmAbi for NumberFormat where T: IntoWasmAbi,

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

impl<T> TryFromJsValue for NumberFormat where T: JsCast,

impl<T> VectorFromWasmAbi for NumberFormat where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorIntoWasmAbi for NumberFormat where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorRefIntoWasmAbi for NumberFormat where &'a T: for<'a> Into<JsValue>,

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

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

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