pub struct Time { /* private fields */ }Expand description
A time value (microseconds since midnight).
Implementations§
Source§impl Time
impl Time
Sourcepub const MICROS_PER_SECOND: u64 = 1_000_000
pub const MICROS_PER_SECOND: u64 = 1_000_000
Microseconds per second
Sourcepub const MICROS_PER_MINUTE: u64
pub const MICROS_PER_MINUTE: u64
Microseconds per minute
Sourcepub const MICROS_PER_HOUR: u64
pub const MICROS_PER_HOUR: u64
Microseconds per hour
Sourcepub const MAX_MICROSECONDS: u64
pub const MAX_MICROSECONDS: u64
Maximum valid microseconds value (24 hours - 1 microsecond).
Sourcepub const fn from_microseconds(microseconds: u64) -> Time
pub const fn from_microseconds(microseconds: u64) -> Time
Creates a Time from microseconds since midnight.
No validation is performed. For a checked variant, use
try_from_microseconds.
Sourcepub fn try_from_microseconds(
microseconds: u64,
) -> Result<Time, Box<dyn Error + Sync + Send>>
pub fn try_from_microseconds( microseconds: u64, ) -> Result<Time, Box<dyn Error + Sync + Send>>
Creates a Time from microseconds since midnight with validation.
§Errors
Returns an error if microseconds > MAX_MICROSECONDS
(i.e. >= 24 hours).
Sourcepub const fn new(hour: u32, minute: u32, second: u32, microsecond: u32) -> Time
pub const fn new(hour: u32, minute: u32, second: u32, microsecond: u32) -> Time
Creates a Time from hour, minute, second, microsecond components.
Sourcepub const fn microseconds(&self) -> u64
pub const fn microseconds(&self) -> u64
Returns microseconds since midnight.
Sourcepub const fn to_hms_micro(&self) -> (u32, u32, u32, u32)
pub const fn to_hms_micro(&self) -> (u32, u32, u32, u32)
Returns hour, minute, second, microsecond components.
Sourcepub const fn to_microseconds(&self) -> i64
pub const fn to_microseconds(&self) -> i64
Returns microseconds since midnight as i64 for insertion.
This is the same as microseconds() but as signed for the Inserter API.
Trait Implementations§
Source§impl FromBinaryValue for Time
impl FromBinaryValue for Time
Source§impl FromHyperBinary for Time
impl FromHyperBinary for Time
Source§impl ToHyperBinary for Time
impl ToHyperBinary for Time
Source§fn to_hyper_binary(
&self,
buf: &mut BytesMut,
) -> Result<(), Box<dyn Error + Sync + Send>>
fn to_hyper_binary( &self, buf: &mut BytesMut, ) -> Result<(), Box<dyn Error + Sync + Send>>
Serializes the value to HyperBinary format for a nullable column. Read more
Source§fn to_hyper_binary_not_null(
&self,
buf: &mut BytesMut,
) -> Result<(), Box<dyn Error + Sync + Send>>
fn to_hyper_binary_not_null( &self, buf: &mut BytesMut, ) -> Result<(), Box<dyn Error + Sync + Send>>
Serializes the value to HyperBinary format for a NOT NULL column. Read more
Source§fn hyper_binary_size(&self) -> usize
fn hyper_binary_size(&self) -> usize
Returns the size in bytes this value will occupy when serialized (nullable).
Source§fn hyper_binary_size_not_null(&self) -> usize
fn hyper_binary_size_not_null(&self) -> usize
Returns the size in bytes this value will occupy when serialized (not nullable).
Source§impl ToSqlParam for Time
impl ToSqlParam for Time
impl Copy for Time
impl Eq 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 UnsafeUnpin for Time
impl UnwindSafe for Time
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request