Enum datafusion::common::stats::Precision
source · pub enum Precision<T>where
T: Debug + Clone + PartialEq + Eq + PartialOrd,{
Exact(T),
Inexact(T),
Absent,
}
Expand description
Represents a value with a degree of certainty. Precision
is used to
propagate information the precision of statistical values.
Variants§
Exact(T)
The exact value is known
Inexact(T)
The value is not known exactly, but is likely close to this value
Absent
Nothing is known about the value
Implementations§
source§impl<T> Precision<T>where
T: Debug + Clone + PartialEq + Eq + PartialOrd,
impl<T> Precision<T>where T: Debug + Clone + PartialEq + Eq + PartialOrd,
sourcepub fn get_value(&self) -> Option<&T>
pub fn get_value(&self) -> Option<&T>
If we have some value (exact or inexact), it returns that value.
Otherwise, it returns None
.
sourcepub fn map<F>(self, f: F) -> Precision<T>where
F: Fn(T) -> T,
pub fn map<F>(self, f: F) -> Precision<T>where F: Fn(T) -> T,
Transform the value in this Precision
object, if one exists, using
the given function. Preserves the exactness state.
sourcepub fn is_exact(&self) -> Option<bool>
pub fn is_exact(&self) -> Option<bool>
Returns Some(true)
if we have an exact value, Some(false)
if we
have an inexact value, and None
if there is no value.
sourcepub fn max(&self, other: &Precision<T>) -> Precision<T>
pub fn max(&self, other: &Precision<T>) -> Precision<T>
Returns the maximum of two (possibly inexact) values, conservatively
propagating exactness information. If one of the input values is
Precision::Absent
, the result is Absent
too.
sourcepub fn min(&self, other: &Precision<T>) -> Precision<T>
pub fn min(&self, other: &Precision<T>) -> Precision<T>
Returns the minimum of two (possibly inexact) values, conservatively
propagating exactness information. If one of the input values is
Precision::Absent
, the result is Absent
too.
sourcepub fn to_inexact(self) -> Precision<T>
pub fn to_inexact(self) -> Precision<T>
Demotes the precision state from exact to inexact (if present).
source§impl Precision<usize>
impl Precision<usize>
sourcepub fn add(&self, other: &Precision<usize>) -> Precision<usize>
pub fn add(&self, other: &Precision<usize>) -> Precision<usize>
Calculates the sum of two (possibly inexact) usize
values,
conservatively propagating exactness information. If one of the input
values is Precision::Absent
, the result is Absent
too.
source§impl Precision<ScalarValue>
impl Precision<ScalarValue>
sourcepub fn add(&self, other: &Precision<ScalarValue>) -> Precision<ScalarValue>
pub fn add(&self, other: &Precision<ScalarValue>) -> Precision<ScalarValue>
Calculates the sum of two (possibly inexact) ScalarValue
values,
conservatively propagating exactness information. If one of the input
values is Precision::Absent
, the result is Absent
too.
Trait Implementations§
source§impl<T> PartialEq for Precision<T>where
T: PartialEq + Debug + Clone + Eq + PartialOrd,
impl<T> PartialEq for Precision<T>where T: PartialEq + Debug + Clone + Eq + PartialOrd,
impl<T> Eq for Precision<T>where T: Eq + Debug + Clone + PartialEq + PartialOrd,
impl<T> StructuralEq for Precision<T>where T: Debug + Clone + PartialEq + Eq + PartialOrd,
impl<T> StructuralPartialEq for Precision<T>where T: Debug + Clone + PartialEq + Eq + PartialOrd,
Auto Trait Implementations§
impl<T> RefUnwindSafe for Precision<T>where T: RefUnwindSafe,
impl<T> Send for Precision<T>where T: Send,
impl<T> Sync for Precision<T>where T: Sync,
impl<T> Unpin for Precision<T>where T: Unpin,
impl<T> UnwindSafe for Precision<T>where T: UnwindSafe,
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.