#[non_exhaustive]
pub struct DateTime<C: CalendarProtocol> { /* private fields */ }
Expand description

The native Rust implementation of Temporal.PlainDateTime

Implementations§

source§

impl<C: CalendarProtocol> DateTime<C>

source

pub fn new( year: i32, month: i32, day: i32, hour: i32, minute: i32, second: i32, millisecond: i32, microsecond: i32, nanosecond: i32, calendar: CalendarSlot<C> ) -> TemporalResult<Self>

Creates a new validated DateTime.

source

pub fn validate<T: IsoDateSlots>(target: &T) -> bool

Validates whether ISO date slots are within iso limits at noon.

source

pub const fn iso_year(&self) -> i32

Returns this Date’s ISO year value.

source

pub const fn iso_month(&self) -> u8

Returns this Date’s ISO month value.

source

pub const fn iso_day(&self) -> u8

Returns this Date’s ISO day value.

source

pub fn hour(&self) -> u8

Returns the hour value

source

pub fn minute(&self) -> u8

Returns the minute value

source

pub fn second(&self) -> u8

Returns the second value

source

pub fn millisecond(&self) -> u16

Returns the millisecond value

source

pub fn microsecond(&self) -> u16

Returns the microsecond value

source

pub fn nanosecond(&self) -> u16

Returns the nanosecond value

source

pub fn calendar(&self) -> &CalendarSlot<C>

Returns the Calendar value.

source§

impl DateTime<()>

source

pub fn year(&self) -> TemporalResult<i32>

Returns the calendar year value.

source

pub fn month(&self) -> TemporalResult<u8>

Returns the calendar month value.

source

pub fn month_code(&self) -> TemporalResult<TinyAsciiStr<4>>

Returns the calendar month code value.

source

pub fn day(&self) -> TemporalResult<u8>

Returns the calendar day value.

source

pub fn day_of_week(&self) -> TemporalResult<u16>

Returns the calendar day of week value.

source

pub fn day_of_year(&self) -> TemporalResult<u16>

Returns the calendar day of year value.

source

pub fn week_of_year(&self) -> TemporalResult<u16>

Returns the calendar week of year value.

source

pub fn year_of_week(&self) -> TemporalResult<i32>

Returns the calendar year of week value.

source

pub fn days_in_week(&self) -> TemporalResult<u16>

Returns the calendar days in week value.

source

pub fn days_in_month(&self) -> TemporalResult<u16>

Returns the calendar days in month value.

source

pub fn days_in_year(&self) -> TemporalResult<u16>

Returns the calendar days in year value.

source

pub fn months_in_year(&self) -> TemporalResult<u16>

Returns the calendar months in year value.

source

pub fn in_leap_year(&self) -> TemporalResult<bool>

Returns returns whether the date in a leap year for the given calendar.

source§

impl<C: CalendarProtocol> DateTime<C>

source

pub fn contextual_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<i32>

Returns the calendar year value with provided context.

source

pub fn contextual_month( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u8>

Returns the calendar month value with provided context.

source

pub fn contextual_month_code( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<TinyAsciiStr<4>>

Returns the calendar month code value with provided context.

source

pub fn contextual_day( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u8>

Returns the calendar day value with provided context.

source

pub fn contextual_day_of_week( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>

Returns the calendar day of week value with provided context.

source

pub fn contextual_day_of_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>

Returns the calendar day of year value with provided context.

source

pub fn contextual_week_of_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>

Returns the calendar week of year value with provided context.

source

pub fn contextual_year_of_week( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<i32>

Returns the calendar year of week value with provided context.

source

pub fn contextual_days_in_week( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>

Returns the calendar days in week value with provided context.

source

pub fn contextual_days_in_month( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>

Returns the calendar days in month value with provided context.

source

pub fn contextual_days_in_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>

Returns the calendar days in year value with provided context.

source

pub fn contextual_months_in_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<u16>

Returns the calendar months in year value with provided context.

source

pub fn contextual_in_leap_year( this: &C::DateTime, context: &mut C::Context ) -> TemporalResult<bool>

Returns whether the date is in a leap year for the given calendar with provided context.

Trait Implementations§

source§

impl<C: Clone + CalendarProtocol> Clone for DateTime<C>

source§

fn clone(&self) -> DateTime<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Debug + CalendarProtocol> Debug for DateTime<C>

source§

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

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

impl<C: Default + CalendarProtocol> Default for DateTime<C>

source§

fn default() -> DateTime<C>

Returns the “default value” for a type. Read more
source§

impl<C: CalendarProtocol> FromStr for DateTime<C>

§

type Err = TemporalError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<C: CalendarProtocol> GetCalendarSlot<C> for DateTime<C>

source§

fn get_calendar(&self) -> CalendarSlot<C>

Returns the CalendarSlot<C> value of the implementor.
source§

impl<C: CalendarProtocol> IsoDateSlots for DateTime<C>

source§

fn iso_date(&self) -> IsoDate

Returns the target’s internal IsoDate.

Auto Trait Implementations§

§

impl<C> RefUnwindSafe for DateTime<C>
where C: RefUnwindSafe,

§

impl<C> !Send for DateTime<C>

§

impl<C> !Sync for DateTime<C>

§

impl<C> Unpin for DateTime<C>
where C: Unpin,

§

impl<C> UnwindSafe for DateTime<C>
where C: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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