Struct sqldatetime::Time
source · #[repr(transparent)]pub struct Time(_);Expand description
Time represents a valid time of day.
Implementations§
source§impl Time
impl Time
sourcepub const unsafe fn from_hms_unchecked(
hour: u32,
minute: u32,
sec: u32,
usec: u32
) -> Time
pub const unsafe fn from_hms_unchecked( hour: u32, minute: u32, sec: u32, usec: u32 ) -> Time
Creates a Time from the given 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_hms(
hour: u32,
minute: u32,
sec: u32,
usec: u32
) -> Result<Time, Error>
pub const fn try_from_hms( hour: u32, minute: u32, sec: u32, usec: u32 ) -> Result<Time, Error>
Creates a Time from the given hour, minute, second and microsecond.
sourcepub const fn is_valid(hour: u32, minute: u32, sec: u32, usec: u32) -> bool
pub const fn is_valid(hour: u32, minute: u32, sec: u32, usec: u32) -> bool
Checks if the given hour, minute, second and microsecond fields are valid.
sourcepub const unsafe fn from_usecs_unchecked(usecs: i64) -> Self
pub const unsafe fn from_usecs_unchecked(usecs: i64) -> Self
Creates a Time from the given microseconds without checking validity.
Safety
This function is unsafe because the microsecond value is not checked for validity! Before using it, check that the value is 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 Time from the given microseconds
sourcepub const fn extract(self) -> (u32, u32, u32, u32)
pub const fn extract(self) -> (u32, u32, u32, u32)
Extracts (hour, minute, second, microsecond) from the time.
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 Time 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 Time from given string and format.
sourcepub const fn sub_time(self, time: Time) -> IntervalDT
pub const fn sub_time(self, time: Time) -> IntervalDT
Time subtracts Time
sourcepub const fn add_interval_dt(self, interval: IntervalDT) -> Time
pub const fn add_interval_dt(self, interval: IntervalDT) -> Time
Time adds IntervalDT
sourcepub const fn sub_interval_dt(self, interval: IntervalDT) -> Time
pub const fn sub_interval_dt(self, interval: IntervalDT) -> Time
Time subtracts IntervalDT
Trait Implementations§
source§impl<'de> Deserialize<'de> for Time
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Time
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 Ord for Time
impl Ord for Time
source§impl PartialEq<IntervalDT> for Time
impl PartialEq<IntervalDT> for Time
source§fn eq(&self, other: &IntervalDT) -> bool
fn eq(&self, other: &IntervalDT) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialEq<Time> for IntervalDT
impl PartialEq<Time> for IntervalDT
source§impl PartialEq<Time> for Time
impl PartialEq<Time> for Time
source§impl PartialOrd<IntervalDT> for Time
impl PartialOrd<IntervalDT> for Time
source§fn partial_cmp(&self, other: &IntervalDT) -> Option<Ordering>
fn partial_cmp(&self, other: &IntervalDT) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl PartialOrd<Time> for IntervalDT
impl PartialOrd<Time> for IntervalDT
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl PartialOrd<Time> for Time
impl PartialOrd<Time> for Time
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more