pub struct Time(/* private fields */);Expand description
A wrapper type for chrono::NaiveTime.
Implementations§
Source§impl Time
impl Time
Sourcepub fn try_new(hour: u32, minute: u32, second: u32) -> Result<Self, Error>
pub fn try_new(hour: u32, minute: u32, second: u32) -> Result<Self, Error>
Attempts to create a new instance.
Sourcepub fn num_secs_from_midnight(&self) -> u32
pub fn num_secs_from_midnight(&self) -> u32
Returns the number of non-leap seconds past the last midnight.
Sourcepub fn num_millis_from_midnight(&self) -> u32
pub fn num_millis_from_midnight(&self) -> u32
Returns the number of non-leap milliseconds past the last midnight.
Sourcepub fn num_micros_from_midnight(&self) -> u32
pub fn num_micros_from_midnight(&self) -> u32
Returns the number of non-leap microseconds past the last midnight.
Sourcepub fn format(&self, fmt: &str) -> String
pub fn format(&self, fmt: &str) -> String
Formats the time with the specified format string.
See format::strftime for the supported escape sequences.
Sourcepub fn duration_since(&self, earlier: Time) -> Duration
pub fn duration_since(&self, earlier: Time) -> Duration
Returns the amount of time elapsed from another time to this one, or zero duration if that time is later than this one.
Sourcepub fn span_between(&self, other: Time) -> Duration
pub fn span_between(&self, other: Time) -> Duration
Returns the duration of time between self and other.
Sourcepub fn span_between_now(&self) -> Duration
pub fn span_between_now(&self) -> Duration
Returns the duration of time between self and Time::now().
Sourcepub fn span_before_now(&self) -> Option<Duration>
pub fn span_before_now(&self) -> Option<Duration>
Returns the duration of time from self to Time::now().
Sourcepub fn span_after_now(&self) -> Option<Duration>
pub fn span_after_now(&self) -> Option<Duration>
Returns the duration of time from Time::now() to self.
Trait Implementations§
Source§impl AddAssign<Duration> for Time
impl AddAssign<Duration> for Time
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+= operation. Read moreSource§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>,
Source§impl<'a> From<Time> for FluentValue<'a>
Available on crate feature i18n only.
impl<'a> From<Time> for FluentValue<'a>
i18n only.Source§impl Ord for Time
impl Ord for Time
Source§impl PartialOrd for Time
impl PartialOrd for Time
Source§impl SubAssign<Duration> for Time
impl SubAssign<Duration> for Time
Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-= operation. Read moreimpl 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.