pub struct IntervalDT(/* private fields */);
Expand description
Day-Time Interval
represents the duration of a period of time,
has an interval precision that includes DAY, HOUR, MINUTE, SECOND, MICROSECOND.
Implementations§
Source§impl IntervalDT
impl IntervalDT
Sourcepub const MIN: Self
pub const MIN: Self
The smallest interval that can be represented by IntervalDT
, i.e. -100000000 00:00:00.000000
.
Sourcepub const MAX: Self
pub const MAX: Self
The largest interval that can be represented by IntervalDT
, i.e. 100000000 00:00:00.000000
.
Sourcepub const unsafe fn from_dhms_unchecked(
day: u32,
hour: u32,
minute: u32,
sec: u32,
usec: u32,
) -> Self
pub const unsafe fn from_dhms_unchecked( day: u32, hour: u32, minute: u32, sec: u32, usec: u32, ) -> Self
Creates a IntervalDT
from the given day, hour, minute, second and microsecond.
§Safety
This function is unsafe because the values are not checked for validity! Before using it, check that the values are all correct.
Sourcepub const fn try_from_dhms(
day: u32,
hour: u32,
minute: u32,
sec: u32,
usec: u32,
) -> Result<Self, Error>
pub const fn try_from_dhms( day: u32, hour: u32, minute: u32, sec: u32, usec: u32, ) -> Result<Self, Error>
Creates a IntervalDT
from the given day, hour, minute, second and microsecond.
Sourcepub const unsafe fn from_usecs_unchecked(usecs: i64) -> Self
pub const unsafe fn from_usecs_unchecked(usecs: i64) -> Self
Creates a IntervalDT
from the given microseconds without checking the validity.
§Safety
This function is unsafe because the microsecond value is not checked for validity! Before using it, check that the value is all correct.
Sourcepub const fn try_from_usecs(usecs: i64) -> Result<Self, Error>
pub const fn try_from_usecs(usecs: i64) -> Result<Self, Error>
Creates a IntervalDT
from the given microseconds.
Sourcepub const fn is_valid(
day: u32,
hour: u32,
minute: u32,
sec: u32,
usec: u32,
) -> bool
pub const fn is_valid( day: u32, hour: u32, minute: u32, sec: u32, usec: u32, ) -> bool
Checks if the given day, hour, minute, second and microsecond fields are valid.
Sourcepub const fn extract(self) -> (Sign, u32, u32, u32, u32, u32)
pub const fn extract(self) -> (Sign, u32, u32, u32, u32, u32)
Extracts (sign, day, hour, minute, second, microsecond)
from the interval.
Sourcepub fn format<S: AsRef<str>>(self, fmt: S) -> Result<impl Display, Error>
pub fn format<S: AsRef<str>>(self, fmt: S) -> Result<impl Display, Error>
Formats IntervalDT
by given format string.
Sourcepub fn parse<S1: AsRef<str>, S2: AsRef<str>>(
input: S1,
fmt: S2,
) -> Result<Self, Error>
pub fn parse<S1: AsRef<str>, S2: AsRef<str>>( input: S1, fmt: S2, ) -> Result<Self, Error>
Parses IntervalDT
from given string and format.
Sourcepub const fn add_interval_dt(
self,
interval: IntervalDT,
) -> Result<IntervalDT, Error>
pub const fn add_interval_dt( self, interval: IntervalDT, ) -> Result<IntervalDT, Error>
IntervalDT
adds IntervalDT
Sourcepub const fn sub_interval_dt(
self,
interval: IntervalDT,
) -> Result<IntervalDT, Error>
pub const fn sub_interval_dt( self, interval: IntervalDT, ) -> Result<IntervalDT, Error>
IntervalDT
subtracts IntervalDT
Trait Implementations§
Source§impl Clone for IntervalDT
impl Clone for IntervalDT
Source§fn clone(&self) -> IntervalDT
fn clone(&self) -> IntervalDT
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl DateTime for IntervalDT
impl DateTime for IntervalDT
Source§impl Debug for IntervalDT
impl Debug for IntervalDT
Source§impl<'de> Deserialize<'de> for IntervalDT
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for IntervalDT
serde
only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl From<IntervalDT> for Time
impl From<IntervalDT> for Time
Source§fn from(interval: IntervalDT) -> Self
fn from(interval: IntervalDT) -> Self
Source§impl From<Time> for IntervalDT
impl From<Time> for IntervalDT
Source§impl Hash for IntervalDT
impl Hash for IntervalDT
Source§impl Neg for IntervalDT
impl Neg for IntervalDT
Source§impl Ord for IntervalDT
impl Ord for IntervalDT
Source§fn cmp(&self, other: &IntervalDT) -> Ordering
fn cmp(&self, other: &IntervalDT) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<IntervalDT> for Time
impl PartialEq<IntervalDT> for Time
Source§impl PartialEq<Time> for IntervalDT
impl PartialEq<Time> for IntervalDT
Source§impl PartialEq for IntervalDT
impl PartialEq for IntervalDT
Source§impl PartialOrd<IntervalDT> for Time
impl PartialOrd<IntervalDT> for Time
Source§impl PartialOrd<Time> for IntervalDT
impl PartialOrd<Time> for IntervalDT
Source§impl PartialOrd for IntervalDT
impl PartialOrd for IntervalDT
Source§impl Serialize for IntervalDT
Available on crate feature serde
only.
impl Serialize for IntervalDT
serde
only.