pub(crate) enum SupportedPrecision {
Seconds,
Milliseconds,
Microseconds,
Nanoseconds,
Picoseconds,
}Expand description
A sub-second precision that names a unit: the decimal exponent Substrait stores, and the duration suffix that writes it.
Substrait allows any precision from 0 to 12 on a type, but a literal
value has to be written down, and only these five have a unit to write it
in. Constructing a SupportedPrecision checks that once, so code holding one
can convert without re-checking.
Not every literal supports every variant: chrono-backed literals
(timestamp, time) top out at nanoseconds, so they reject Picoseconds.
Variants§
Implementations§
Source§impl SupportedPrecision
impl SupportedPrecision
Sourcepub fn from_units(units: i32) -> Option<Self>
pub fn from_units(units: i32) -> Option<Self>
Returns None for a precision with no unit to write it in.
Sourcepub fn subsecond_unit(self) -> Option<&'static str>
pub fn subsecond_unit(self) -> Option<&'static str>
The duration-string suffix for sub-seconds at this precision.
Seconds has none: at precision 0 there is no sub-second component.
Sourcepub fn from_subsecond_unit(unit: &str) -> Option<Self>
pub fn from_subsecond_unit(unit: &str) -> Option<Self>
The precision implied by a duration-string sub-second suffix.
Trait Implementations§
Source§impl Clone for SupportedPrecision
impl Clone for SupportedPrecision
Source§fn clone(&self) -> SupportedPrecision
fn clone(&self) -> SupportedPrecision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SupportedPrecision
impl Debug for SupportedPrecision
Source§impl Display for SupportedPrecision
impl Display for SupportedPrecision
Source§impl Ord for SupportedPrecision
impl Ord for SupportedPrecision
Source§fn cmp(&self, other: &SupportedPrecision) -> Ordering
fn cmp(&self, other: &SupportedPrecision) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SupportedPrecision
impl PartialEq for SupportedPrecision
Source§fn eq(&self, other: &SupportedPrecision) -> bool
fn eq(&self, other: &SupportedPrecision) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for SupportedPrecision
impl PartialOrd for SupportedPrecision
impl Copy for SupportedPrecision
impl Eq for SupportedPrecision
impl StructuralPartialEq for SupportedPrecision
Auto Trait Implementations§
impl Freeze for SupportedPrecision
impl RefUnwindSafe for SupportedPrecision
impl Send for SupportedPrecision
impl Sync for SupportedPrecision
impl Unpin for SupportedPrecision
impl UnsafeUnpin for SupportedPrecision
impl UnwindSafe for SupportedPrecision
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.