Enum repr::Datum [−][src]
pub enum Datum<'a> {
Show 22 variants
False,
True,
Int16(i16),
Int32(i32),
Int64(i64),
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)
Tuple Fields
0: i16A 16-bit signed integer.
Int32(i32)
Tuple Fields
0: i32A 32-bit signed integer.
Int64(i64)
Tuple Fields
0: i64A 64-bit signed integer.
Float32(OrderedFloat<f32>)
Tuple Fields
0: OrderedFloat<f32>A 32-bit floating point number.
Float64(OrderedFloat<f64>)
Tuple Fields
0: OrderedFloat<f64>A 64-bit floating point number.
Date(NaiveDate)
Tuple Fields
0: NaiveDateA date.
Time(NaiveTime)
Tuple Fields
0: NaiveTimeA time.
Timestamp(NaiveDateTime)
Tuple Fields
A date and time, without a timezone.
TimestampTz(DateTime<Utc>)
A date and time, with a timezone.
Interval(Interval)
Tuple Fields
0: IntervalA span of time.
Bytes(&'a [u8])
A sequence of untyped bytes.
String(&'a str)
Tuple Fields
0: &'a strA sequence of Unicode codepoints encoded as UTF-8.
Array(Array<'a>)
Tuple Fields
0: Array<'a>Unlike Datum::List, arrays are like tensors and are not permitted to
be ragged.
List(DatumList<'a>)
Tuple Fields
0: DatumList<'a>A sequence of Datums.
Unlike Datum::Array, lists are permitted to be ragged.
Map(DatumMap<'a>)
Tuple Fields
0: DatumMap<'a>A mapping from string keys to Datums.
Numeric(OrderedDecimal<Numeric>)
Tuple Fields
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)
Tuple Fields
0: UuidA 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
Reports whether this datum is null (i.e., is Datum::Null).
Unwraps the boolean value within this datum.
Panics
Panics if the datum is not Datum::False or Datum::True.
Unwraps the 32-bit floating-point value within this datum.
Panics
Panics if the datum is not Datum::Float32.
Unwraps the 64-bit floating-point value within this datum.
Panics
Panics if the datum is not Datum::Float64.
Unwraps the timestamptz value within this datum.
Panics
Panics if the datum is not Datum::TimestampTz.
Reports whether this datum is an instance of the specified column type.
Trait Implementations
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
Convert this Rust type into a Result containing a Datum, or an error
Performs the conversion.
Performs the conversion.
Performs the conversion.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for Datum<'a>
impl<'a> UnwindSafe for Datum<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Formats an object with the “alternative” format ({:#}) and returns it.
Compare self to key and return true if they are equal.
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more