Skip to main content

Value

Enum Value 

Source
pub enum Value<'a> {
Show 13 variants 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 { lat: f64, lon: f64, alt: Option<f64>, }, Rect { min_lat: f64, min_lon: f64, max_lat: f64, max_lon: 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>)

Calendar date in RFC 3339 format (e.g., “2024-01-15” or “2024-01-15+05:30”).

§

Time(Cow<'a, str>)

Time of day in RFC 3339 format (e.g., “14:30:45.123456Z” or “14:30:45+05:30”).

§

Datetime(Cow<'a, str>)

Combined date and time in RFC 3339 format (e.g., “2024-01-15T14:30:45.123456Z”).

§

Schedule(Cow<'a, str>)

RFC 5545 iCalendar schedule string.

§

Point

WGS84 geographic coordinate with optional altitude.

Fields

§lat: f64

Latitude in degrees (-90 to +90).

§lon: f64

Longitude in degrees (-180 to +180).

§alt: Option<f64>

Altitude in meters above WGS84 ellipsoid (optional).

§

Rect

Axis-aligned bounding box in WGS84 coordinates.

Fields

§min_lat: f64

Southern edge latitude (-90 to +90).

§min_lon: f64

Western edge longitude (-180 to +180).

§max_lat: f64

Northern edge latitude (-90 to +90).

§max_lon: f64

Eastern edge longitude (-180 to +180).

§

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.