Struct temporal_rs::TemporalFields
source · 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
Property | Conversion | Default |
---|---|---|
“year” | ToIntegerWithTruncation | undefined |
“month” | ToPositiveIntegerWithTruncation | undefined |
“monthCode” | ToPrimitiveAndRequireString | undefined |
“day” | ToPositiveIntegerWithTruncation | undefined |
“hour” | ToIntegerWithTruncation | +0𝔽 |
“minute” | ToIntegerWithTruncation | +0𝔽 |
“second” | ToIntegerWithTruncation | +0𝔽 |
“millisecond” | ToIntegerWithTruncation | +0𝔽 |
“microsecond” | ToIntegerWithTruncation | +0𝔽 |
“nanosecond” | ToIntegerWithTruncation | +0𝔽 |
“offset” | ToPrimitiveAndRequireString | undefined |
“era” | ToPrimitiveAndRequireString | undefined |
“eraYear” | ToIntegerWithTruncation | undefined |
“timeZone” | None | undefined |
Implementations§
source§impl TemporalFields
impl TemporalFields
sourcepub fn require_field(&mut self, field: &str)
pub fn require_field(&mut self, field: &str)
Flags a field as being required.
sourcepub fn set_field_value(
&mut self,
field: &str,
value: &FieldValue
) -> TemporalResult<()>
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.
sourcepub fn get(&self, field: &str) -> Option<FieldValue>
pub fn get(&self, field: &str) -> Option<FieldValue>
Retrieves a field value if set, else None.
source§impl TemporalFields
impl TemporalFields
sourcepub fn active_kvs(&self) -> Vec<(String, FieldValue)>
pub fn active_kvs(&self) -> Vec<(String, FieldValue)>
Returns a vector filled with the key-value pairs marked as active.
sourcepub fn merge_fields<C: CalendarProtocol>(
&self,
other: &Self,
calendar: &CalendarSlot<C>
) -> TemporalResult<Self>
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
impl Debug for TemporalFields
Auto Trait Implementations§
impl RefUnwindSafe for TemporalFields
impl Send for TemporalFields
impl Sync for TemporalFields
impl Unpin for TemporalFields
impl UnwindSafe for TemporalFields
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more