Value

Enum Value 

Source
pub enum Value<'a> {
    Bool(bool),
    Int64 {
        value: i64,
        unit: Option<Id>,
    },
    Float64 {
        value: f64,
        unit: Option<Id>,
    },
    Decimal {
        exponent: i32,
        mantissa: DecimalMantissa<'a>,
        unit: Option<Id>,
    },
    Text {
        value: Cow<'a, str>,
        language: Option<Id>,
    },
    Bytes(Cow<'a, [u8]>),
    Date(Cow<'a, str>),
    Time(Cow<'a, str>),
    Datetime(Cow<'a, str>),
    Schedule(Cow<'a, str>),
    Point {
        lon: f64,
        lat: f64,
        alt: Option<f64>,
    },
    Embedding {
        sub_type: EmbeddingSubType,
        dims: usize,
        data: Cow<'a, [u8]>,
    },
}
Expand description

A typed value that can be stored on an entity or relation.

Variants§

§

Bool(bool)

Boolean value.

§

Int64

64-bit signed integer with optional unit.

Fields

§value: i64
§unit: Option<Id>

Unit entity ID, or None for no unit.

§

Float64

64-bit IEEE 754 float (NaN not allowed) with optional unit.

Fields

§value: f64
§unit: Option<Id>

Unit entity ID, or None for no unit.

§

Decimal

Arbitrary-precision decimal: value = mantissa * 10^exponent, with optional unit.

Fields

§exponent: i32
§mantissa: DecimalMantissa<'a>
§unit: Option<Id>

Unit entity ID, or None for no unit.

§

Text

UTF-8 text with optional language.

Fields

§value: Cow<'a, str>
§language: Option<Id>

Language entity ID, or None for default language.

§

Bytes(Cow<'a, [u8]>)

Opaque byte array.

§

Date(Cow<'a, str>)

ISO 8601 date string (YYYY, YYYY-MM, or YYYY-MM-DD).

§

Time(Cow<'a, str>)

ISO 8601 time string with timezone (HH:MM:SS[.frac]TZ).

§

Datetime(Cow<'a, str>)

ISO 8601 datetime string (YYYY-MM-DDTHH:MM:SS[.frac][TZ]).

§

Schedule(Cow<'a, str>)

RFC 5545 iCalendar schedule string.

§

Point

WGS84 geographic coordinate with optional altitude.

Fields

§lon: f64

Longitude in degrees (-180 to +180).

§lat: f64

Latitude in degrees (-90 to +90).

§alt: Option<f64>

Altitude in meters above WGS84 ellipsoid (optional).

§

Embedding

Dense vector for semantic similarity search.

Fields

§dims: usize
§data: Cow<'a, [u8]>

Raw bytes in the format specified by sub_type.

Implementations§

Source§

impl Value<'_>

Source

pub fn data_type(&self) -> DataType

Returns the data type of this value.

Source

pub fn validate(&self) -> Option<&'static str>

Validates this value according to spec rules.

Returns an error description if invalid, None if valid.

Trait Implementations§

Source§

impl<'a> Clone for Value<'a>

Source§

fn clone(&self) -> Value<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Value<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for Value<'a>

Source§

fn eq(&self, other: &Value<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructuralPartialEq for Value<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Value<'a>

§

impl<'a> RefUnwindSafe for Value<'a>

§

impl<'a> Send for Value<'a>

§

impl<'a> Sync for Value<'a>

§

impl<'a> Unpin for Value<'a>

§

impl<'a> UnwindSafe for Value<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.