Struct DurationFormat

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

The Intl.DurationFormat object enables language-sensitive duration formatting.

MDN documentation

Implementations

impl DurationFormat

fn format(&self, duration: &Duration) -> JsString

Formats a duration according to the locale and formatting options.

MDN documentation

impl DurationFormat

fn supported_locales_of(locales: &[JsString], options: &LocaleMatcherOptions) -> Result<Array<JsString>, JsValue>

Returns an array of supported locales.

Throws a RangeError if locales contain invalid values.

MDN documentation

impl DurationFormat

fn format_to_parts(&self, duration: &Duration) -> Array<DurationFormatPart>

Returns an array of objects representing the formatted duration in parts.

MDN documentation

impl DurationFormat

fn new(locales: &[JsString], options: &DurationFormatOptions) -> Result<DurationFormat, JsValue>

Creates a new Intl.DurationFormat object.

Throws a RangeError if locales or options contain invalid values.

MDN documentation

impl DurationFormat

fn resolved_options(&self) -> ResolvedDurationFormatOptions

Returns an object with properties reflecting the options used.

MDN documentation

Trait Implementations

impl AsRef<DurationFormat> for DurationFormat

fn as_ref(&self) -> &DurationFormat

impl AsRef<JsValue> for DurationFormat

fn as_ref(&self) -> &JsValue

impl AsRef<Object> for DurationFormat

fn as_ref(&self) -> &Object

impl Clone for DurationFormat

fn clone(&self) -> Self

impl Debug for DurationFormat

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

impl Default for DurationFormat

fn default() -> Self

impl Deref for DurationFormat

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

impl ErasableGeneric for DurationFormat

type Repr = JsValue;

impl From<JsValue> for DurationFormat

fn from(obj: JsValue) -> Self

impl FromWasmAbi for DurationFormat

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

impl IntoJsGeneric for DurationFormat where DurationFormat: JsGeneric,

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

impl IntoWasmAbi for DurationFormat

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

impl JsCast for DurationFormat

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

impl LongRefFromWasmAbi for DurationFormat

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

impl OptionFromWasmAbi for DurationFormat

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

impl OptionIntoWasmAbi for DurationFormat

fn none() -> Self::Abi

impl Promising for DurationFormat

type Resolution = DurationFormat;

impl RefFromWasmAbi for DurationFormat

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

impl UpcastFrom<DurationFormat> for DurationFormat

impl WasmDescribe for DurationFormat

fn describe()

Auto Trait Implementations

impl Freeze for DurationFormat

impl RefUnwindSafe for DurationFormat

impl Send for DurationFormat

impl Sync for DurationFormat

impl Unpin for DurationFormat

impl UnsafeUnpin for DurationFormat

impl UnwindSafe for DurationFormat

Blanket Implementations

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

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

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

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

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

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

impl<T> From<T> for DurationFormat

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

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

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

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

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

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

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

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

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

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