pub struct Time<T: Prefix> { /* private fields */ }
Expand description
An amount of time. Should only use the time prefix types (TimePrefix
and
TimePrefixUpper
) with this type.
Implementations§
Trait Implementations§
source§impl<'de, T: Prefix> Deserialize<'de> for Time<T>
impl<'de, T: Prefix> Deserialize<'de> for Time<T>
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 From<Time<TimePrefix>> for Duration
impl From<Time<TimePrefix>> for Duration
source§fn from(time: Time<TimePrefix>) -> Self
fn from(time: Time<TimePrefix>) -> Self
Converts to this type from the input type.
source§impl From<Time<TimePrefixUpper>> for Duration
impl From<Time<TimePrefixUpper>> for Duration
source§fn from(time: Time<TimePrefixUpper>) -> Self
fn from(time: Time<TimePrefixUpper>) -> Self
Converts to this type from the input type.
source§impl<T: Prefix> JsonSchema for Time<T>
impl<T: Prefix> JsonSchema for Time<T>
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§impl<T: Prefix> Unit for Time<T>
impl<T: Prefix> Unit for Time<T>
type U = u64
type T = T
fn suffixes() -> &'static [&'static str]
source§fn convert(&self, prefix: Self::T) -> Result<Self, String>
fn convert(&self, prefix: Self::T) -> Result<Self, String>
Convert value to a different prefix, but return an error if the conversion
cannot be done without possibly losing precision.
source§fn convert_lossy(&self, prefix: Self::T) -> Self
fn convert_lossy(&self, prefix: Self::T) -> Self
Convert value to a different prefix, even if it loses precision.
impl<T: Copy + Prefix> Copy for Time<T>
impl<T: Eq + Prefix> Eq for Time<T>
impl<T: Prefix> StructuralPartialEq for Time<T>
Auto Trait Implementations§
impl<T> Freeze for Time<T>where
T: Freeze,
impl<T> RefUnwindSafe for Time<T>where
T: RefUnwindSafe,
impl<T> Send for Time<T>where
T: Send,
impl<T> Sync for Time<T>where
T: Sync,
impl<T> Unpin for Time<T>where
T: Unpin,
impl<T> UnwindSafe for Time<T>where
T: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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> 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>
Converts
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>
Converts
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 more