pub enum Resolution {
Show 19 variants
Day,
AmPm,
TimeOfDay,
ThreeHour,
Hour,
ThirtyMinute,
FifteenMinute,
FiveMinute,
Minute,
ThirtySecond,
FifteenSecond,
FiveSecond,
Second,
FiveHundredMilli,
HundredMilli,
FiftyMilli,
TenMilli,
FiveMilli,
Millisecond,
}Expand description
There are 19 resolutions available:
- milli, 5ms, 10ms, 50ms, 100ms, 500ms
- second, 5s, 15s, 30s
- minute, 5m, 15m, 30m
- hour, 3h, 6h, 12h (am/pm)
- whole day
The Ord impl follows natural-language: x < y means that x is
lower-resolution than y.
§How were these chosen?
The rule is that, for any pair of resolutions, one must be an exact integer multiple of the other. So this means, for example that “10m” and “15m” are incompatible resolutions. You can choose to allow one, or the other, but not both. (I picked 15m.)
FYI you can see this integer multiple by dividing one resolution by another:
assert_eq!(Resolution::ThirtySecond / Resolution::FiftyMilli, 600);Variants§
Day
AmPm
TimeOfDay
ThreeHour
Hour
ThirtyMinute
FifteenMinute
FiveMinute
Minute
ThirtySecond
FifteenSecond
FiveSecond
Second
FiveHundredMilli
HundredMilli
FiftyMilli
TenMilli
FiveMilli
Millisecond
Implementations§
Trait Implementations§
Source§impl Clone for Resolution
impl Clone for Resolution
Source§fn clone(&self) -> Resolution
fn clone(&self) -> Resolution
Returns a copy 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 Resolution
impl Debug for Resolution
Source§impl Display for Resolution
impl Display for Resolution
Source§impl Div for Resolution
impl Div for Resolution
Source§impl From<Resolution> for Duration
impl From<Resolution> for Duration
Source§fn from(value: Resolution) -> Self
fn from(value: Resolution) -> Self
Converts to this type from the input type.
Source§impl Linearize for Resolution
impl Linearize for Resolution
Source§unsafe fn from_linear_unchecked(linear: usize) -> Self
unsafe fn from_linear_unchecked(linear: usize) -> Self
The inverse of the
linearize function. Read moreSource§impl Ord for Resolution
impl Ord for Resolution
Source§fn cmp(&self, other: &Resolution) -> Ordering
fn cmp(&self, other: &Resolution) -> 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 Resolution
impl PartialEq for Resolution
Source§impl PartialOrd for Resolution
impl PartialOrd for Resolution
impl Copy for Resolution
impl Eq for Resolution
impl StructuralPartialEq for Resolution
Auto Trait Implementations§
impl Freeze for Resolution
impl RefUnwindSafe for Resolution
impl Send for Resolution
impl Sync for Resolution
impl Unpin for Resolution
impl UnwindSafe for Resolution
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<T> LinearizeExt for T
impl<T> LinearizeExt for T
Source§fn from_linear(linear: usize) -> Option<T>
fn from_linear(linear: usize) -> Option<T>
A safe version of Linearize::from_linear_unchecked. Read more
Source§fn linearized(&self) -> Linearized<T>
fn linearized(&self) -> Linearized<T>
Linearizes this value and stores the value in a Linearized object. Read more