pub struct Time { /* private fields */ }
Expand description
A timestamp with a time zone.
Implementations§
Source§impl Time
impl Time
Sourcepub fn from_unix_ms(timestamp: i64) -> Self
pub fn from_unix_ms(timestamp: i64) -> Self
Returns a value representing the given Unix timestamp in milliseconds.
Sourcepub fn as_rfc3339(&self) -> impl Display
pub fn as_rfc3339(&self) -> impl Display
Formats the time according to RFC 3339.
Sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Returns the duration elapsed since this time occurred.
If the time is in the future, this function returns Duration::ZERO
.
Sourcepub fn hms(&self) -> (usize, usize, usize)
pub fn hms(&self) -> (usize, usize, usize)
Returns the hour, minute, and second numbers.
Equivalent to (time.hour(), time.minute(), time.second())
.
pub fn start_of_day(&self) -> Time
Sourcepub fn start_of_hour(&self) -> Time
pub fn start_of_hour(&self) -> Time
Returns a new time at the start of the hour of this time.
Trait Implementations§
Source§impl AddAssign<Time> for Span
impl AddAssign<Time> for Span
Source§fn add_assign(&mut self, rhs: Time)
fn add_assign(&mut self, rhs: Time)
Performs the
+=
operation. Read moreSource§impl<'a> FromSql<'a> for Time
impl<'a> FromSql<'a> for Time
Source§fn from_sql(
ty: &Type,
raw: &'a [u8],
) -> Result<Self, Box<dyn Error + Sync + Send>>
fn from_sql( ty: &Type, raw: &'a [u8], ) -> Result<Self, Box<dyn Error + Sync + Send>>
Creates a new value of this type from a buffer of data of the specified
Postgres
Type
in its binary format. Read moreSource§fn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Determines if a value of this type can be created from the specified
Postgres
Type
.Source§impl Ord for Time
impl Ord for Time
Source§impl PartialOrd for Time
impl PartialOrd for Time
Source§impl ToSql for Time
impl ToSql for Time
Source§fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
Converts the value of
self
into the binary format of the specified
Postgres Type
, appending it to out
. Read moreimpl Copy for Time
impl Eq 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§
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> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
Source§fn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to
self
as a ToSql
trait object.