pub enum AlignmentUnit {
Unaligned,
Millisecond,
Second,
Minute,
Hour,
Day,
Week,
Month,
Year,
}Expand description
Used to keep track of the smallest unit provided, so that we can line up windows (eg. at the start of the hour, week, year, …)
Variants§
Implementations§
Source§impl AlignmentUnit
impl AlignmentUnit
Sourcepub fn align_timestamp(&self, timestamp: i64) -> i64
pub fn align_timestamp(&self, timestamp: i64) -> i64
Floors a UTC timestamp in milliseconds since Unix epoch to the nearest alignment unit.
Trait Implementations§
Source§impl Clone for AlignmentUnit
impl Clone for AlignmentUnit
Source§fn clone(&self) -> AlignmentUnit
fn clone(&self) -> AlignmentUnit
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 AlignmentUnit
impl Debug for AlignmentUnit
Source§impl Ord for AlignmentUnit
impl Ord for AlignmentUnit
Source§fn cmp(&self, other: &AlignmentUnit) -> Ordering
fn cmp(&self, other: &AlignmentUnit) -> 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 PartialEq for AlignmentUnit
impl PartialEq for AlignmentUnit
Source§impl PartialOrd for AlignmentUnit
impl PartialOrd for AlignmentUnit
Source§impl TryFrom<&str> for AlignmentUnit
impl TryFrom<&str> for AlignmentUnit
Source§impl TryFrom<String> for AlignmentUnit
impl TryFrom<String> for AlignmentUnit
impl Copy for AlignmentUnit
impl Eq for AlignmentUnit
impl StructuralPartialEq for AlignmentUnit
Auto Trait Implementations§
impl Freeze for AlignmentUnit
impl RefUnwindSafe for AlignmentUnit
impl Send for AlignmentUnit
impl Sync for AlignmentUnit
impl Unpin for AlignmentUnit
impl UnwindSafe for AlignmentUnit
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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