pub enum Datum<'a> {
Show 24 variants
False,
True,
Int16(i16),
Int32(i32),
Int64(i64),
UInt8(u8),
UInt32(u32),
Float32(OrderedFloat<f32>),
Float64(OrderedFloat<f64>),
Date(NaiveDate),
Time(NaiveTime),
Timestamp(NaiveDateTime),
TimestampTz(DateTime<Utc>),
Interval(Interval),
Bytes(&'a [u8]),
String(&'a str),
Array(Array<'a>),
List(DatumList<'a>),
Map(DatumMap<'a>),
Numeric(OrderedDecimal<Numeric>),
JsonNull,
Uuid(Uuid),
Dummy,
Null,
}
Expand description
A single value.
Note that Datum
must always derive Eq
to enforce equality with
repr::Row
.
Variants
False
The false
boolean value.
True
The true
boolean value.
Int16(i16)
A 16-bit signed integer.
Int32(i32)
A 32-bit signed integer.
Int64(i64)
A 64-bit signed integer.
UInt8(u8)
An 8-bit unsigned integer.
UInt32(u32)
A 32-bit unsigned integer.
Float32(OrderedFloat<f32>)
A 32-bit floating point number.
Float64(OrderedFloat<f64>)
A 64-bit floating point number.
Date(NaiveDate)
A date.
Time(NaiveTime)
A time.
Timestamp(NaiveDateTime)
A date and time, without a timezone.
TimestampTz(DateTime<Utc>)
A date and time, with a timezone.
Interval(Interval)
A span of time.
Bytes(&'a [u8])
A sequence of untyped bytes.
String(&'a str)
A sequence of Unicode codepoints encoded as UTF-8.
Array(Array<'a>)
Unlike Datum::List
, arrays are like tensors and are not permitted to
be ragged.
List(DatumList<'a>)
A sequence of Datum
s.
Unlike Datum::Array
, lists are permitted to be ragged.
Map(DatumMap<'a>)
A mapping from string keys to Datum
s.
Numeric(OrderedDecimal<Numeric>)
An exact decimal number, possibly with a fractional component, with up to 39 digits of precision.
JsonNull
An unknown value within a JSON-typed Datum
.
This variant is distinct from Datum::Null
as a null datum is
distinct from a non-null datum that contains the JSON value null
.
Uuid(Uuid)
A universally unique identifier.
Dummy
A placeholder value.
Dummy values are never meant to be observed. Many operations on Datum
panic if called on this variant.
Dummies are useful as placeholders in e.g. a Vec<Datum>
, where it is
known that a certain element of the vector is never observed and
therefore needn’t be computed, but where some Datum
must still be
provided to maintain the shape of the vector. While any valid datum
could be used for this purpose, having a dedicated variant makes it
obvious when these optimizations have gone awry. If we used e.g.
Datum::Null
, an unexpected Datum::Null
could indicate any number of
problems: bad user data, bad function metadata, or a bad optimization.
Null
An unknown value.
Implementations
sourceimpl<'a> Datum<'a>
impl<'a> Datum<'a>
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Reports whether this datum is null (i.e., is Datum::Null
).
sourcepub fn unwrap_bool(&self) -> bool
pub fn unwrap_bool(&self) -> bool
Unwraps the boolean value within this datum.
Panics
Panics if the datum is not Datum::False
or Datum::True
.
sourcepub fn unwrap_int16(&self) -> i16
pub fn unwrap_int16(&self) -> i16
sourcepub fn unwrap_int32(&self) -> i32
pub fn unwrap_int32(&self) -> i32
sourcepub fn unwrap_int64(&self) -> i64
pub fn unwrap_int64(&self) -> i64
sourcepub fn unwrap_uint8(&self) -> u8
pub fn unwrap_uint8(&self) -> u8
sourcepub fn unwrap_uint32(&self) -> u32
pub fn unwrap_uint32(&self) -> u32
Unwraps the 64-bit integer value within this datum.
Panics
Panics if the datum is not Datum::UInt32
.
pub fn unwrap_ordered_float32(&self) -> OrderedFloat<f32>
pub fn unwrap_ordered_float64(&self) -> OrderedFloat<f64>
sourcepub fn unwrap_float32(&self) -> f32
pub fn unwrap_float32(&self) -> f32
Unwraps the 32-bit floating-point value within this datum.
Panics
Panics if the datum is not Datum::Float32
.
sourcepub fn unwrap_float64(&self) -> f64
pub fn unwrap_float64(&self) -> f64
Unwraps the 64-bit floating-point value within this datum.
Panics
Panics if the datum is not Datum::Float64
.
sourcepub fn unwrap_date(&self) -> NaiveDate
pub fn unwrap_date(&self) -> NaiveDate
sourcepub fn unwrap_time(&self) -> NaiveTime
pub fn unwrap_time(&self) -> NaiveTime
sourcepub fn unwrap_timestamp(&self) -> NaiveDateTime
pub fn unwrap_timestamp(&self) -> NaiveDateTime
sourcepub fn unwrap_timestamptz(&self) -> DateTime<Utc>
pub fn unwrap_timestamptz(&self) -> DateTime<Utc>
Unwraps the timestamptz value within this datum.
Panics
Panics if the datum is not Datum::TimestampTz
.
sourcepub fn unwrap_interval(&self) -> Interval
pub fn unwrap_interval(&self) -> Interval
sourcepub fn unwrap_str(&self) -> &'a str
pub fn unwrap_str(&self) -> &'a str
sourcepub fn unwrap_bytes(&self) -> &'a [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn unwrap_bytes(&self) -> &'a [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
sourcepub fn unwrap_uuid(&self) -> Uuid
pub fn unwrap_uuid(&self) -> Uuid
sourcepub fn unwrap_array(&self) -> Array<'a>
pub fn unwrap_array(&self) -> Array<'a>
sourcepub fn unwrap_list(&self) -> DatumList<'a>
pub fn unwrap_list(&self) -> DatumList<'a>
sourcepub fn unwrap_map(&self) -> DatumMap<'a>
pub fn unwrap_map(&self) -> DatumMap<'a>
sourcepub fn unwrap_numeric(&self) -> OrderedDecimal<Numeric>
pub fn unwrap_numeric(&self) -> OrderedDecimal<Numeric>
sourcepub fn is_instance_of(self, column_type: &ColumnType) -> bool
pub fn is_instance_of(self, column_type: &ColumnType) -> bool
Reports whether this datum is an instance of the specified column type.
sourceimpl Datum<'_>
impl Datum<'_>
pub fn empty_array() -> Datum<'static>
pub fn empty_list() -> Datum<'static>
Trait Implementations
sourceimpl<'a, E> DatumType<'a, E> for Datum<'a>
impl<'a, E> DatumType<'a, E> for Datum<'a>
sourcefn try_from_result(
res: Result<Datum<'a>, E>
) -> Result<Self, Result<Datum<'a>, E>>
fn try_from_result(
res: Result<Datum<'a>, E>
) -> Result<Self, Result<Datum<'a>, E>>
Try to convert a Result whose Ok variant is a Datum into this native Rust type (Self). If it fails the error variant will contain the original result. Read more
sourcefn into_result(self, _temp_storage: &'a RowArena) -> Result<Datum<'a>, E>
fn into_result(self, _temp_storage: &'a RowArena) -> Result<Datum<'a>, E>
Convert this Rust type into a Result containing a Datum, or an error
sourceimpl<'a> From<NaiveDateTime> for Datum<'a>
impl<'a> From<NaiveDateTime> for Datum<'a>
sourcefn from(dt: NaiveDateTime) -> Datum<'a>
fn from(dt: NaiveDateTime) -> Datum<'a>
Converts to this type from the input type.
sourceimpl<'a> From<OrderedFloat<f32>> for Datum<'a>
impl<'a> From<OrderedFloat<f32>> for Datum<'a>
sourcefn from(f: OrderedFloat<f32>) -> Datum<'a>
fn from(f: OrderedFloat<f32>) -> Datum<'a>
Converts to this type from the input type.
sourceimpl<'a> From<OrderedFloat<f64>> for Datum<'a>
impl<'a> From<OrderedFloat<f64>> for Datum<'a>
sourcefn from(f: OrderedFloat<f64>) -> Datum<'a>
fn from(f: OrderedFloat<f64>) -> Datum<'a>
Converts to this type from the input type.
sourceimpl<'a> Ord for Datum<'a>
impl<'a> Ord for Datum<'a>
sourceimpl<'a> PartialOrd<Datum<'a>> for Datum<'a>
impl<'a> PartialOrd<Datum<'a>> for Datum<'a>
sourcefn partial_cmp(&self, other: &Datum<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &Datum<'a>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl TryFrom<Datum<'_>> for NaiveDateTime
impl TryFrom<Datum<'_>> for NaiveDateTime
impl<'a> Copy for Datum<'a>
impl<'a> Eq for Datum<'a>
impl<'a> StructuralEq for Datum<'a>
impl<'a> StructuralPartialEq for Datum<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for Datum<'a>
impl<'a> Send for Datum<'a>
impl<'a> Sync for Datum<'a>
impl<'a> Unpin for Datum<'a>
impl<'a> UnwindSafe for Datum<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for T where
T: Hash + ?Sized,
impl<T> CallHasher for T where
T: Hash + ?Sized,
sourceimpl<T> DisplayExt for T where
T: Display,
impl<T> DisplayExt for T where
T: Display,
sourcefn to_string_alt(&self) -> String
fn to_string_alt(&self) -> String
Formats an object with the “alternative” format ({:#}
) and returns it.
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
impl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more