pub struct VDateTime(/* private fields */);Expand description
A datetime value.
VDateTime can represent offset date-times, local date-times, local dates,
or local times. This covers all datetime types in TOML and most other formats.
Implementations§
Source§impl VDateTime
impl VDateTime
Sourcepub fn new_offset(
year: i32,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
nanos: u32,
offset_minutes: i16,
) -> Self
pub fn new_offset( year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, nanos: u32, offset_minutes: i16, ) -> Self
Creates a new offset date-time.
§Arguments
year- Year (negative for BCE)month- Month (1-12)day- Day (1-31)hour- Hour (0-23)minute- Minute (0-59)second- Second (0-59, or 60 for leap second)nanos- Nanoseconds (0-999_999_999)offset_minutes- Offset from UTC in minutes
Sourcepub fn new_local_datetime(
year: i32,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
nanos: u32,
) -> Self
pub fn new_local_datetime( year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, nanos: u32, ) -> Self
Creates a new local date-time (no offset).
Sourcepub fn new_local_date(year: i32, month: u8, day: u8) -> Self
pub fn new_local_date(year: i32, month: u8, day: u8) -> Self
Creates a new local date (no time component).
Sourcepub fn new_local_time(hour: u8, minute: u8, second: u8, nanos: u32) -> Self
pub fn new_local_time(hour: u8, minute: u8, second: u8, nanos: u32) -> Self
Creates a new local time (no date component).
Sourcepub fn kind(&self) -> DateTimeKind
pub fn kind(&self) -> DateTimeKind
Returns the kind of datetime.
Sourcepub fn second(&self) -> u8
pub fn second(&self) -> u8
Returns the second (0-59, or 60 for leap second). Returns 0 for LocalDate.
Sourcepub fn offset_minutes(&self) -> Option<i16>
pub fn offset_minutes(&self) -> Option<i16>
Returns the UTC offset in minutes, if this is an offset datetime.
Sourcepub fn has_offset(&self) -> bool
pub fn has_offset(&self) -> bool
Returns true if this datetime has an offset.
Trait Implementations§
Source§impl PartialOrd for VDateTime
impl PartialOrd for VDateTime
impl Eq for VDateTime
Auto Trait Implementations§
impl Freeze for VDateTime
impl RefUnwindSafe for VDateTime
impl Send for VDateTime
impl Sync for VDateTime
impl Unpin for VDateTime
impl UnwindSafe for VDateTime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.