pub struct Time { /* private fields */ }Expand description
A time value representing time of day (hour, minute, second, nanosecond) without date information.
Internally stored as nanoseconds since midnight (00:00:00.000000000).
Implementations§
Source§impl Time
impl Time
pub fn new(hour: u32, min: u32, sec: u32, nano: u32) -> Option<Self>
pub fn from_hms(hour: u32, min: u32, sec: u32) -> Result<Self, String>
pub fn from_hms_nano( hour: u32, min: u32, sec: u32, nano: u32, ) -> Result<Self, String>
pub fn midnight() -> Self
pub fn noon() -> Self
pub fn hour(&self) -> u32
pub fn minute(&self) -> u32
pub fn second(&self) -> u32
pub fn nanosecond(&self) -> u32
Sourcepub fn to_nanos_since_midnight(&self) -> u64
pub fn to_nanos_since_midnight(&self) -> u64
Convert to nanoseconds since midnight for storage
Sourcepub fn from_nanos_since_midnight(nanos: u64) -> Option<Self>
pub fn from_nanos_since_midnight(nanos: u64) -> Option<Self>
Create from nanoseconds since midnight for storage
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Time
impl Ord for Time
Source§impl PartialOrd for Time
impl PartialOrd for Time
Source§impl TryFromValue for Time
impl TryFromValue for Time
Source§fn try_from_value(value: &Value) -> Result<Self, FromValueError>
fn try_from_value(value: &Value) -> Result<Self, FromValueError>
Attempt to extract a value of this type from a Value. Read more
impl Copy for Time
impl Eq for Time
impl IsTemporal for Time
impl IsTime for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)