Enum tidb_query_datatype::codec::data_type::ScalarValue[][src]

pub enum ScalarValue {
    Int(Option<Int>),
    Real(Option<Real>),
    Decimal(Option<Decimal>),
    Bytes(Option<Bytes>),
    DateTime(Option<DateTime>),
    Duration(Option<Duration>),
    Json(Option<Json>),
    Enum(Option<Enum>),
    Set(Option<Set>),
}

A scalar value container, a.k.a. datum, for all concrete eval types.

In many cases, for example, at the framework level, the concrete eval type is unknown at compile time. So we use this enum container to represent types dynamically. It is similar to trait object Box<T> where T is a concrete eval type but faster.

Like VectorValue, the inner concrete value is immutable.

Compared to VectorValue, it only contains a single concrete value. Compared to Datum, it is a newer encapsulation that naturally wraps Option<..>.

TODO: Once we removed the Option<..> wrapper, it will be much like Datum. At that time, we only need to preserve one of them.

Variants

Int(Option<Int>)
Real(Option<Real>)
Decimal(Option<Decimal>)
Bytes(Option<Bytes>)
DateTime(Option<DateTime>)
Duration(Option<Duration>)
Json(Option<Json>)
Enum(Option<Enum>)
Set(Option<Set>)

Implementations

impl ScalarValue[src]

pub fn eval_type(&self) -> EvalType[src]

pub fn as_scalar_value_ref(&self) -> ScalarValueRef<'_>[src]

pub fn is_none(&self) -> bool[src]

pub fn is_some(&self) -> bool[src]

impl ScalarValue[src]

pub fn as_int(&self) -> Option<&Int>[src]

impl ScalarValue[src]

pub fn as_real(&self) -> Option<&Real>[src]

impl ScalarValue[src]

pub fn as_decimal(&self) -> Option<&Decimal>[src]

impl ScalarValue[src]

pub fn as_date_time(&self) -> Option<&DateTime>[src]

impl ScalarValue[src]

pub fn as_duration(&self) -> Option<&Duration>[src]

impl ScalarValue[src]

pub fn as_json(&self) -> Option<JsonRef<'_>>[src]

impl ScalarValue[src]

pub fn as_bytes(&self) -> Option<BytesRef<'_>>[src]

Trait Implementations

impl AsMySQLBool for ScalarValue[src]

impl Clone for ScalarValue[src]

impl Debug for ScalarValue[src]

impl From<Decimal> for ScalarValue[src]

impl From<Duration> for ScalarValue[src]

impl From<Json> for ScalarValue[src]

impl From<NotNan<f64>> for ScalarValue[src]

impl<'a> From<Option<&'a [u8]>> for ScalarValue[src]

impl From<Option<Decimal>> for ScalarValue[src]

impl From<Option<Duration>> for ScalarValue[src]

impl From<Option<Json>> for ScalarValue[src]

impl<'a> From<Option<JsonRef<'a>>> for ScalarValue[src]

impl From<Option<NotNan<f64>>> for ScalarValue[src]

impl From<Option<Time>> for ScalarValue[src]

impl From<Option<Vec<u8, Global>>> for ScalarValue[src]

impl From<Option<f64>> for ScalarValue[src]

impl From<Option<i64>> for ScalarValue[src]

impl From<Time> for ScalarValue[src]

impl From<Vec<u8, Global>> for ScalarValue[src]

impl From<f64> for ScalarValue[src]

impl From<i64> for ScalarValue[src]

impl PartialEq<ScalarValue> for ScalarValue[src]

impl<'a> PartialEq<ScalarValue> for ScalarValueRef<'a>[src]

impl<'a> PartialEq<ScalarValueRef<'a>> for ScalarValue[src]

impl StructuralPartialEq for ScalarValue[src]

Auto Trait Implementations

impl RefUnwindSafe for ScalarValue

impl Send for ScalarValue

impl Sync for ScalarValue

impl Unpin for ScalarValue

impl UnwindSafe for ScalarValue

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]