pub struct TemporalFields { /* private fields */ }
Expand description

TemporalFields acts as a native Rust implementation of the fields object

The temporal fields are laid out in the Temporal proposal under section 13.46 PrepareTemporalFields with conversion and defaults laid out by Table 17 (displayed below).

§Table 17: Temporal field requirements

PropertyConversionDefault
“year”ToIntegerWithTruncationundefined
“month”ToPositiveIntegerWithTruncationundefined
“monthCode”ToPrimitiveAndRequireStringundefined
“day”ToPositiveIntegerWithTruncationundefined
“hour”ToIntegerWithTruncation+0𝔽
“minute”ToIntegerWithTruncation+0𝔽
“second”ToIntegerWithTruncation+0𝔽
“millisecond”ToIntegerWithTruncation+0𝔽
“microsecond”ToIntegerWithTruncation+0𝔽
“nanosecond”ToIntegerWithTruncation+0𝔽
“offset”ToPrimitiveAndRequireStringundefined
“era”ToPrimitiveAndRequireStringundefined
“eraYear”ToIntegerWithTruncationundefined
“timeZone”Noneundefined

Implementations§

source§

impl TemporalFields

source

pub fn require_field(&mut self, field: &str)

Flags a field as being required.

source

pub fn set_field_value( &mut self, field: &str, value: &FieldValue ) -> TemporalResult<()>

A generic field setter for TemporalFields

This method will not run any JsValue conversion. FieldValue is expected to contain a preconverted value.

source

pub fn get(&self, field: &str) -> Option<FieldValue>

Retrieves a field value if set, else None.

source§

impl TemporalFields

source

pub fn active_kvs(&self) -> Vec<(String, FieldValue)>

Returns a vector filled with the key-value pairs marked as active.

source

pub fn keys(&self) -> Keys

Returns an iterator over the current keys.

source

pub fn values(&self) -> Values<'_>

Returns an iterator over the current values.

source

pub fn merge_fields<C: CalendarProtocol>( &self, other: &Self, calendar: &CalendarSlot<C> ) -> TemporalResult<Self>

Merges two TemporalFields values given a specific CalendarSlot.

Trait Implementations§

source§

impl Debug for TemporalFields

source§

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

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

impl Default for TemporalFields

source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T