Enum repr::scalar::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: i16

A 16-bit signed integer.

Int32(i32)

Tuple Fields

0: i32

A 32-bit signed integer.

Int64(i64)

Tuple Fields

0: i64

A 64-bit signed integer.

Float32(OrderedFloat<f32>)

Tuple Fields

A 32-bit floating point number.

Float64(OrderedFloat<f64>)

Tuple Fields

A 64-bit floating point number.

Date(NaiveDate)

Tuple Fields

A date.

Time(NaiveTime)

Tuple Fields

A time.

Timestamp(NaiveDateTime)

Tuple Fields

A date and time, without a timezone.

TimestampTz(DateTime<Utc>)

Tuple Fields

A date and time, with a timezone.

Interval(Interval)

Tuple Fields

A span of time.

Bytes(&'a [u8])

Tuple Fields

A sequence of untyped bytes.

String(&'a str)

Tuple Fields

0: &'a str

A 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: 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

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 16-bit integer value within this datum.

Panics

Panics if the datum is not Datum::Int16.

Unwraps the 32-bit integer value within this datum.

Panics

Panics if the datum is not Datum::Int32.

Unwraps the 64-bit integer value within this datum.

Panics

Panics if the datum is not Datum::Int64.

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 date value within this datum.

Panics

Panics if the datum is not Datum::Date.

Unwraps the time value within this datum.

Panics

Panics if the datum is not Datum::Time.

Unwraps the timestamp value within this datum.

Panics

Panics if the datum is not Datum::Timestamp.

Unwraps the timestamptz value within this datum.

Panics

Panics if the datum is not Datum::TimestampTz.

Unwraps the interval value within this datum.

Panics

Panics if the datum is not Datum::Interval.

Unwraps the string value within this datum.

Panics

Panics if the datum is not Datum::String.

Unwraps the bytes value within this datum.

Panics

Panics if the datum is not Datum::Bytes.

Unwraps the uuid value within this datum.

Panics

Panics if the datum is not Datum::Uuid.

Unwraps the array value within this datum.

Panics

Panics if the datum is not Datum::Array.

Unwraps the list value within this datum.

Panics

Panics if the datum is not Datum::List.

Unwraps the map value within this datum.

Panics

Panics if the datum is not Datum::Map.

Unwraps the numeric value within this datum.

Panics

Panics if the datum is not Datum::Numeric.

Reports whether this datum is an instance of the specified column type.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Whether this Rust type can represent NULL values

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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

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.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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