pub struct RelativeTime {
pub amount: i64,
pub unit: TimeUnit,
pub direction: Direction,
}Expand description
Represents a time relative to the current moment.
§Examples
use temps_core::{RelativeTime, TimeUnit, Direction};
// "in 5 minutes"
let future = RelativeTime {
amount: 5,
unit: TimeUnit::Minute,
direction: Direction::Future,
};
// "3 days ago"
let past = RelativeTime {
amount: 3,
unit: TimeUnit::Day,
direction: Direction::Past,
};Fields§
§amount: i64The numeric amount (e.g., 5 in “5 minutes”)
unit: TimeUnitThe time unit (second, minute, hour, etc.)
direction: DirectionWhether this is in the past or future
Trait Implementations§
Source§impl Clone for RelativeTime
impl Clone for RelativeTime
Source§fn clone(&self) -> RelativeTime
fn clone(&self) -> RelativeTime
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 Debug for RelativeTime
impl Debug for RelativeTime
Source§impl Hash for RelativeTime
impl Hash for RelativeTime
Source§impl PartialEq for RelativeTime
impl PartialEq for RelativeTime
impl Copy for RelativeTime
impl Eq for RelativeTime
impl StructuralPartialEq for RelativeTime
Auto Trait Implementations§
impl Freeze for RelativeTime
impl RefUnwindSafe for RelativeTime
impl Send for RelativeTime
impl Sync for RelativeTime
impl Unpin for RelativeTime
impl UnsafeUnpin for RelativeTime
impl UnwindSafe for RelativeTime
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