#[repr(transparent)]pub struct Time(pub i64);Expand description
Represents a time of day with nanosecond precision.
This struct is a wrapper around an i64 value representing the number of nanoseconds
since midnight. It provides various methods for creating, manipulating, and converting
time values.
Tuple Fields§
§0: i64Implementations§
Source§impl Time
impl Time
Sourcepub const fn from_i64(nanos: i64) -> Time
pub const fn from_i64(nanos: i64) -> Time
Creates a new Time instance from the given number of nanoseconds.
Sourcepub const fn is_nat(&self) -> bool
pub const fn is_nat(&self) -> bool
Checks if the time is “not a time” (NAT).
Returns true if the internal value is i64::MIN, which represents an invalid time.
Sourcepub const fn is_not_nat(&self) -> bool
pub const fn is_not_nat(&self) -> bool
Checks if the time is a valid time (not NAT).
Returns true if the internal value is not i64::MIN.
Sourcepub const fn as_cr(&self) -> Option<NaiveTime>
pub const fn as_cr(&self) -> Option<NaiveTime>
Converts the Time instance to a chrono::NaiveTime, if valid.
Sourcepub const fn from_hms(hour: i64, min: i64, sec: i64) -> Time
pub const fn from_hms(hour: i64, min: i64, sec: i64) -> Time
Creates a Time instance from hours, minutes, and seconds.
Sourcepub const fn from_hms_milli(hour: i64, min: i64, sec: i64, milli: i64) -> Time
pub const fn from_hms_milli(hour: i64, min: i64, sec: i64, milli: i64) -> Time
Creates a Time instance from hours, minutes, seconds, and milliseconds.
Sourcepub const fn from_hms_micro(hour: i64, min: i64, sec: i64, micro: i64) -> Time
pub const fn from_hms_micro(hour: i64, min: i64, sec: i64, micro: i64) -> Time
Creates a Time instance from hours, minutes, seconds, and microseconds.
Sourcepub const fn from_hms_nano(hour: i64, min: i64, sec: i64, nano: i64) -> Time
pub const fn from_hms_nano(hour: i64, min: i64, sec: i64, nano: i64) -> Time
Creates a Time instance from hours, minutes, seconds, and nanoseconds.
Sourcepub const fn from_num_seconds_from_midnight(secs: i64, nano: i64) -> Time
pub const fn from_num_seconds_from_midnight(secs: i64, nano: i64) -> Time
Creates a Time instance from the number of seconds since midnight and additional nanoseconds.
Trait Implementations§
Source§impl IsNone for Time
Available on crate feature time only.
impl IsNone for Time
time only.type Inner = Time
type Cast<U: IsNone<Inner = U> + Clone> = U
Source§fn to_opt(self) -> Option<Self::Inner>
fn to_opt(self) -> Option<Self::Inner>
Option<Self::Inner>. Read moreSource§fn as_opt(&self) -> Option<&Self::Inner>
fn as_opt(&self) -> Option<&Self::Inner>
Option<&Self::Inner>. Read moreSource§fn from_inner(inner: Self::Inner) -> Self
fn from_inner(inner: Self::Inner) -> Self
Self from the given inner value. Read morefn unwrap(self) -> Self::Inner
Source§fn map<F, U: IsNone>(self, f: F) -> U
fn map<F, U: IsNone>(self, f: F) -> U
Self, if it exists. Read moreSource§fn from_opt(opt: Option<Self::Inner>) -> Self
fn from_opt(opt: Option<Self::Inner>) -> Self
Self from an Option<Self::Inner>.fn not_none(&self) -> bool
Source§fn sort_cmp(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
fn sort_cmp(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
None as the largest value. Read moreSource§fn sort_cmp_rev(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
fn sort_cmp_rev(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
None as the largest value. Read more