Struct sqldatetime::IntervalDT
source · [−]#[repr(transparent)]pub struct IntervalDT(_);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
sourceimpl 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
sourceimpl Clone for IntervalDT
impl Clone for IntervalDT
sourcefn clone(&self) -> IntervalDT
fn clone(&self) -> IntervalDT
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl DateTime for IntervalDT
impl DateTime for IntervalDT
sourceimpl Debug for IntervalDT
impl Debug for IntervalDT
sourceimpl<'de> Deserialize<'de> for IntervalDT
Available on crate feature serde only.
impl<'de> Deserialize<'de> for IntervalDT
serde only.sourcefn 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>,
sourceimpl From<IntervalDT> for Time
impl From<IntervalDT> for Time
sourcefn from(interval: IntervalDT) -> Self
fn from(interval: IntervalDT) -> Self
sourceimpl From<Time> for IntervalDT
impl From<Time> for IntervalDT
sourceimpl Hash for IntervalDT
impl Hash for IntervalDT
sourceimpl Neg for IntervalDT
impl Neg for IntervalDT
sourceimpl Ord for IntervalDT
impl Ord for IntervalDT
sourcefn cmp(&self, other: &IntervalDT) -> Ordering
fn cmp(&self, other: &IntervalDT) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<IntervalDT> for IntervalDT
impl PartialEq<IntervalDT> for IntervalDT
sourcefn eq(&self, other: &IntervalDT) -> bool
fn eq(&self, other: &IntervalDT) -> bool
sourceimpl PartialEq<IntervalDT> for Time
impl PartialEq<IntervalDT> for Time
sourcefn eq(&self, other: &IntervalDT) -> bool
fn eq(&self, other: &IntervalDT) -> bool
sourceimpl PartialOrd<IntervalDT> for IntervalDT
impl PartialOrd<IntervalDT> for IntervalDT
sourcefn partial_cmp(&self, other: &IntervalDT) -> Option<Ordering>
fn partial_cmp(&self, other: &IntervalDT) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresourceimpl PartialOrd<IntervalDT> for Time
impl PartialOrd<IntervalDT> for Time
sourcefn partial_cmp(&self, other: &IntervalDT) -> Option<Ordering>
fn partial_cmp(&self, other: &IntervalDT) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresourceimpl PartialOrd<Time> for IntervalDT
impl PartialOrd<Time> for IntervalDT
sourcefn partial_cmp(&self, other: &Time) -> Option<Ordering>
fn partial_cmp(&self, other: &Time) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresourceimpl Serialize for IntervalDT
Available on crate feature serde only.
impl Serialize for IntervalDT
serde only.