Struct tor_units::IntegerMilliseconds
source · [−]pub struct IntegerMilliseconds<T> { /* private fields */ }
Expand description
This type represents an integer number of milliseconds.
The underlying type should usually implement TryInto
Implementations
sourceimpl<T> IntegerMilliseconds<T>
impl<T> IntegerMilliseconds<T>
sourcepub fn as_millis(self) -> T
pub fn as_millis(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<IntegerMilliseconds<U>, E> where
F: FnOnce(T) -> Result<U, E>,
pub fn try_map<U, F, E>(self, f: F) -> Result<IntegerMilliseconds<U>, E> where
F: FnOnce(T) -> Result<U, E>,
Map the inner value (useful for conversion)
Example
use tor_units::{BoundedInt32, IntegerMilliseconds};
let value: IntegerMilliseconds<i32> = 42.into();
let value: IntegerMilliseconds<BoundedInt32<0,1000>>
= value.try_map(TryInto::try_into).unwrap();
Trait Implementations
sourceimpl<T: Add<Output = T>> Add<IntegerMilliseconds<T>> for IntegerMilliseconds<T>
impl<T: Add<Output = T>> Add<IntegerMilliseconds<T>> for IntegerMilliseconds<T>
type Output = IntegerMilliseconds<T>
type Output = IntegerMilliseconds<T>
The resulting type after applying the +
operator.
sourcefn add(self, rhs: IntegerMilliseconds<T>) -> IntegerMilliseconds<T>
fn add(self, rhs: IntegerMilliseconds<T>) -> IntegerMilliseconds<T>
Performs the +
operation. Read more
sourceimpl<T: Clone> Clone for IntegerMilliseconds<T>
impl<T: Clone> Clone for IntegerMilliseconds<T>
sourcefn clone(&self) -> IntegerMilliseconds<T>
fn clone(&self) -> IntegerMilliseconds<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug> Debug for IntegerMilliseconds<T>
impl<T: Debug> Debug for IntegerMilliseconds<T>
sourceimpl<T> Display for IntegerMilliseconds<T> where
T: Display,
impl<T> Display for IntegerMilliseconds<T> where
T: Display,
sourceimpl<T, __RhsT> Div<__RhsT> for IntegerMilliseconds<T> where
T: Div<__RhsT, Output = T>,
impl<T, __RhsT> Div<__RhsT> for IntegerMilliseconds<T> where
T: Div<__RhsT, Output = T>,
type Output = IntegerMilliseconds<T>
type Output = IntegerMilliseconds<T>
The resulting type after applying the /
operator.
sourcefn div(self, rhs: __RhsT) -> IntegerMilliseconds<T>
fn div(self, rhs: __RhsT) -> IntegerMilliseconds<T>
Performs the /
operation. Read more
sourceimpl<T> From<T> for IntegerMilliseconds<T>
impl<T> From<T> for IntegerMilliseconds<T>
sourcefn from(original: T) -> IntegerMilliseconds<T>
fn from(original: T) -> IntegerMilliseconds<T>
Converts to this type from the input type.
sourceimpl<T: FromStr> FromStr for IntegerMilliseconds<T>
impl<T: FromStr> FromStr for IntegerMilliseconds<T>
sourceimpl<T, __RhsT> Mul<__RhsT> for IntegerMilliseconds<T> where
T: Mul<__RhsT, Output = T>,
impl<T, __RhsT> Mul<__RhsT> for IntegerMilliseconds<T> where
T: Mul<__RhsT, Output = T>,
type Output = IntegerMilliseconds<T>
type Output = IntegerMilliseconds<T>
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: __RhsT) -> IntegerMilliseconds<T>
fn mul(self, rhs: __RhsT) -> IntegerMilliseconds<T>
Performs the *
operation. Read more
sourceimpl<T: Ord> Ord for IntegerMilliseconds<T>
impl<T: Ord> Ord for IntegerMilliseconds<T>
sourceimpl<T: PartialEq> PartialEq<IntegerMilliseconds<T>> for IntegerMilliseconds<T>
impl<T: PartialEq> PartialEq<IntegerMilliseconds<T>> for IntegerMilliseconds<T>
sourcefn eq(&self, other: &IntegerMilliseconds<T>) -> bool
fn eq(&self, other: &IntegerMilliseconds<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &IntegerMilliseconds<T>) -> bool
fn ne(&self, other: &IntegerMilliseconds<T>) -> bool
This method tests for !=
.
sourceimpl<T: PartialOrd> PartialOrd<IntegerMilliseconds<T>> for IntegerMilliseconds<T>
impl<T: PartialOrd> PartialOrd<IntegerMilliseconds<T>> for IntegerMilliseconds<T>
sourcefn partial_cmp(&self, other: &IntegerMilliseconds<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &IntegerMilliseconds<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const H: i32, const L: i32> TryFrom<i32> for IntegerMilliseconds<BoundedInt32<H, L>>
impl<const H: i32, const L: i32> TryFrom<i32> for IntegerMilliseconds<BoundedInt32<H, L>>
impl<T: Copy> Copy for IntegerMilliseconds<T>
impl<T: Eq> Eq for IntegerMilliseconds<T>
impl<T> StructuralEq for IntegerMilliseconds<T>
impl<T> StructuralPartialEq for IntegerMilliseconds<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for IntegerMilliseconds<T> where
T: RefUnwindSafe,
impl<T> Send for IntegerMilliseconds<T> where
T: Send,
impl<T> Sync for IntegerMilliseconds<T> where
T: Sync,
impl<T> Unpin for IntegerMilliseconds<T> where
T: Unpin,
impl<T> UnwindSafe for IntegerMilliseconds<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more