pub struct IntegerMinutes<T> {
pub(crate) value: T,
}
Expand description
This type represents an integer number of minutes.
The underlying type should usually implement TryInto<u64>
.
Fields§
§value: T
Interior Value. Should Implement TryInto<u64>
to be useful.
Implementations§
Source§impl<T> IntegerMinutes<T>
impl<T> IntegerMinutes<T>
Sourcepub fn as_minutes(self) -> T
pub fn as_minutes(self) -> T
Deconstructor
Use only in contexts where it’s no longer possible to use the Rust type system to ensure secs vs ms vs us correctness.
Sourcepub fn try_map<U, F, E>(self, f: F) -> Result<IntegerMinutes<U>, E>
pub fn try_map<U, F, E>(self, f: F) -> Result<IntegerMinutes<U>, E>
Map the inner value (useful for conversion)
use tor_units::{BoundedInt32, IntegerMinutes};
let value: IntegerMinutes<i32> = 42.into();
let value: IntegerMinutes<BoundedInt32<0,1000>>
= value.try_map(TryInto::try_into).unwrap();
Trait Implementations§
Source§impl<T: Clone> Clone for IntegerMinutes<T>
impl<T: Clone> Clone for IntegerMinutes<T>
Source§fn clone(&self) -> IntegerMinutes<T>
fn clone(&self) -> IntegerMinutes<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Debug> Debug for IntegerMinutes<T>
impl<T: Debug> Debug for IntegerMinutes<T>
Source§impl<'de, T> Deserialize<'de> for IntegerMinutes<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for IntegerMinutes<T>where
T: Deserialize<'de>,
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<T> Display for IntegerMinutes<T>where
T: Display,
impl<T> Display for IntegerMinutes<T>where
T: Display,
Source§impl<T> From<T> for IntegerMinutes<T>
impl<T> From<T> for IntegerMinutes<T>
Source§impl<T: FromStr> FromStr for IntegerMinutes<T>
impl<T: FromStr> FromStr for IntegerMinutes<T>
Source§impl<T: Hash> Hash for IntegerMinutes<T>
impl<T: Hash> Hash for IntegerMinutes<T>
Source§impl<T: Ord> Ord for IntegerMinutes<T>
impl<T: Ord> Ord for IntegerMinutes<T>
Source§fn cmp(&self, other: &IntegerMinutes<T>) -> Ordering
fn cmp(&self, other: &IntegerMinutes<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq> PartialEq for IntegerMinutes<T>
impl<T: PartialEq> PartialEq for IntegerMinutes<T>
Source§impl<T: PartialOrd> PartialOrd for IntegerMinutes<T>
impl<T: PartialOrd> PartialOrd for IntegerMinutes<T>
Source§impl<T> Serialize for IntegerMinutes<T>where
T: Serialize,
impl<T> Serialize for IntegerMinutes<T>where
T: Serialize,
Source§impl<const H: i32, const L: i32> TryFrom<i32> for IntegerMinutes<BoundedInt32<H, L>>
impl<const H: i32, const L: i32> TryFrom<i32> for IntegerMinutes<BoundedInt32<H, L>>
impl<T: Copy> Copy for IntegerMinutes<T>
impl<T: Eq> Eq for IntegerMinutes<T>
impl<T> StructuralPartialEq for IntegerMinutes<T>
Auto Trait Implementations§
impl<T> Freeze for IntegerMinutes<T>where
T: Freeze,
impl<T> RefUnwindSafe for IntegerMinutes<T>where
T: RefUnwindSafe,
impl<T> Send for IntegerMinutes<T>where
T: Send,
impl<T> Sync for IntegerMinutes<T>where
T: Sync,
impl<T> Unpin for IntegerMinutes<T>where
T: Unpin,
impl<T> UnwindSafe for IntegerMinutes<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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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