Struct tor_units::IntegerDays
source · [−]pub struct IntegerDays<T> { /* private fields */ }
Expand description
This type represents an integer number of days.
The underlying type should usually implement TryInto
Implementations
sourceimpl<T> IntegerDays<T>
impl<T> IntegerDays<T>
sourcepub fn as_days(self) -> T
pub fn as_days(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<IntegerDays<U>, E> where
F: FnOnce(T) -> Result<U, E>,
pub fn try_map<U, F, E>(self, f: F) -> Result<IntegerDays<U>, E> where
F: FnOnce(T) -> Result<U, E>,
Map the inner value (useful for conversion)
use tor_units::{BoundedInt32, IntegerDays};
let value: IntegerDays<i32> = 42.into();
let value: IntegerDays<BoundedInt32<0,1000>>
= value.try_map(TryInto::try_into).unwrap();
Trait Implementations
sourceimpl<T: Clone> Clone for IntegerDays<T>
impl<T: Clone> Clone for IntegerDays<T>
sourcefn clone(&self) -> IntegerDays<T>
fn clone(&self) -> IntegerDays<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 IntegerDays<T>
impl<T: Debug> Debug for IntegerDays<T>
sourceimpl<T> Display for IntegerDays<T> where
T: Display,
impl<T> Display for IntegerDays<T> where
T: Display,
sourceimpl<T> From<T> for IntegerDays<T>
impl<T> From<T> for IntegerDays<T>
sourcefn from(original: T) -> IntegerDays<T>
fn from(original: T) -> IntegerDays<T>
Converts to this type from the input type.
sourceimpl<T: FromStr> FromStr for IntegerDays<T>
impl<T: FromStr> FromStr for IntegerDays<T>
sourceimpl<T: Ord> Ord for IntegerDays<T>
impl<T: Ord> Ord for IntegerDays<T>
sourceimpl<T: PartialEq> PartialEq<IntegerDays<T>> for IntegerDays<T>
impl<T: PartialEq> PartialEq<IntegerDays<T>> for IntegerDays<T>
sourcefn eq(&self, other: &IntegerDays<T>) -> bool
fn eq(&self, other: &IntegerDays<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &IntegerDays<T>) -> bool
fn ne(&self, other: &IntegerDays<T>) -> bool
This method tests for !=
.
sourceimpl<T: PartialOrd> PartialOrd<IntegerDays<T>> for IntegerDays<T>
impl<T: PartialOrd> PartialOrd<IntegerDays<T>> for IntegerDays<T>
sourcefn partial_cmp(&self, other: &IntegerDays<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &IntegerDays<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 IntegerDays<BoundedInt32<H, L>>
impl<const H: i32, const L: i32> TryFrom<i32> for IntegerDays<BoundedInt32<H, L>>
impl<T: Copy> Copy for IntegerDays<T>
impl<T: Eq> Eq for IntegerDays<T>
impl<T> StructuralEq for IntegerDays<T>
impl<T> StructuralPartialEq for IntegerDays<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for IntegerDays<T> where
T: RefUnwindSafe,
impl<T> Send for IntegerDays<T> where
T: Send,
impl<T> Sync for IntegerDays<T> where
T: Sync,
impl<T> Unpin for IntegerDays<T> where
T: Unpin,
impl<T> UnwindSafe for IntegerDays<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