Struct RelativeTimeFormat

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

The Intl.RelativeTimeFormat object is a constructor for objects that enable language-sensitive relative time formatting.

MDN documentation

Implementations

impl RelativeTimeFormat

fn format_to_parts(&self, value: f64, unit: &str) -> Array

The Intl.RelativeTimeFormat.prototype.formatToParts() method returns an array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.

MDN documentation

impl RelativeTimeFormat

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

The Intl.RelativeTimeFormat object is a constructor for objects that enable language-sensitive relative time formatting.

MDN documentation

impl RelativeTimeFormat

fn resolved_options(&self) -> Object

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

MDN documentation

impl RelativeTimeFormat

fn format(&self, value: f64, unit: &str) -> JsString

The Intl.RelativeTimeFormat.prototype.format method formats a value and unit according to the locale and formatting options of this Intl.RelativeTimeFormat object.

Throws a RangeError if unit is invalid.

MDN documentation

impl RelativeTimeFormat

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

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

MDN documentation

Trait Implementations

impl AsRef<JsValue> for RelativeTimeFormat

fn as_ref(&self) -> &JsValue

impl AsRef<Object> for RelativeTimeFormat

fn as_ref(&self) -> &Object

impl AsRef<RelativeTimeFormat> for RelativeTimeFormat

fn as_ref(&self) -> &RelativeTimeFormat

impl Clone for RelativeTimeFormat

fn clone(&self) -> Self

impl Debug for RelativeTimeFormat

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

impl Default for RelativeTimeFormat

fn default() -> Self

impl Deref for RelativeTimeFormat

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

impl ErasableGeneric for RelativeTimeFormat

type Repr = JsValue;

impl From<JsValue> for RelativeTimeFormat

fn from(obj: JsValue) -> Self

impl FromWasmAbi for RelativeTimeFormat

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

impl IntoJsGeneric for RelativeTimeFormat where RelativeTimeFormat: JsGeneric,

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

impl IntoWasmAbi for RelativeTimeFormat

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

impl JsCast for RelativeTimeFormat

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

impl LongRefFromWasmAbi for RelativeTimeFormat

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

impl OptionFromWasmAbi for RelativeTimeFormat

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

impl OptionIntoWasmAbi for RelativeTimeFormat

fn none() -> Self::Abi

impl Promising for RelativeTimeFormat

type Resolution = RelativeTimeFormat;

impl RefFromWasmAbi for RelativeTimeFormat

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

impl UpcastFrom<RelativeTimeFormat> for RelativeTimeFormat

impl WasmDescribe for RelativeTimeFormat

fn describe()

Auto Trait Implementations

impl Freeze for RelativeTimeFormat

impl RefUnwindSafe for RelativeTimeFormat

impl Send for RelativeTimeFormat

impl Sync for RelativeTimeFormat

impl Unpin for RelativeTimeFormat

impl UnsafeUnpin for RelativeTimeFormat

impl UnwindSafe for RelativeTimeFormat

Blanket Implementations

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

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

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

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

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

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

impl<T> From<T> for RelativeTimeFormat

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

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

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

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

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

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

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

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

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

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