Value

Enum Value 

Source
pub enum Value {
Show 28 variants Undefined, Boolean(bool), Float4(OrderedF32), Float8(OrderedF64), Int1(i8), Int2(i16), Int4(i32), Int8(i64), Int16(i128), Utf8(String), Uint1(u8), Uint2(u16), Uint4(u32), Uint8(u64), Uint16(u128), Date(Date), DateTime(DateTime), Time(Time), Duration(Duration), RowNumber(RowNumber), IdentityId(IdentityId), Uuid4(Uuid4), Uuid7(Uuid7), Blob(Blob), Int(Int), Uint(Uint), Decimal(Decimal), Any(Box<Value>),
}
Expand description

A RQL value, represented as a native Rust type.

Variants§

§

Undefined

Value is not defined (think null in common programming languages)

§

Boolean(bool)

A boolean: true or false.

§

Float4(OrderedF32)

A 4-byte floating point

§

Float8(OrderedF64)

An 8-byte floating point

§

Int1(i8)

A 1-byte signed integer

§

Int2(i16)

A 2-byte signed integer

§

Int4(i32)

A 4-byte signed integer

§

Int8(i64)

An 8-byte signed integer

§

Int16(i128)

A 16-byte signed integer

§

Utf8(String)

A UTF-8 encoded text. Maximum 255 bytes

§

Uint1(u8)

A 1-byte unsigned integer

§

Uint2(u16)

A 2-byte unsigned integer

§

Uint4(u32)

A 4-byte unsigned integer

§

Uint8(u64)

A 8-byte unsigned integer

§

Uint16(u128)

A 16-byte unsigned integer

§

Date(Date)

A date value (year, month, day)

§

DateTime(DateTime)

A date and time value with nanosecond precision in SVTC

§

Time(Time)

A time value (hour, minute, second, nanosecond)

§

Duration(Duration)

A duration representing a duration

§

RowNumber(RowNumber)

A encoded number (8-byte unsigned integer)

§

IdentityId(IdentityId)

An identity identifier (UUID v7)

§

Uuid4(Uuid4)

A UUID version 4 (random)

§

Uuid7(Uuid7)

A UUID version 7 (timestamp-based)

§

Blob(Blob)

A binary large object (BLOB)

§

Int(Int)

An arbitrary-precision signed integer

§

Uint(Uint)

An arbitrary-precision unsigned integer

§

Decimal(Decimal)

An arbitrary-precision decimal

§

Any(Box<Value>)

A container that can hold any value type

Implementations§

Source§

impl Value

Source

pub fn as_string(&self) -> String

Source§

impl Value

Source

pub fn undefined() -> Self

Source

pub fn bool(v: impl Into<bool>) -> Self

Source

pub fn float4(v: impl Into<f32>) -> Self

Source

pub fn float8(v: impl Into<f64>) -> Self

Source

pub fn int1(v: impl Into<i8>) -> Self

Source

pub fn int2(v: impl Into<i16>) -> Self

Source

pub fn int4(v: impl Into<i32>) -> Self

Source

pub fn int8(v: impl Into<i64>) -> Self

Source

pub fn int16(v: impl Into<i128>) -> Self

Source

pub fn utf8(v: impl Into<String>) -> Self

Source

pub fn uint1(v: impl Into<u8>) -> Self

Source

pub fn uint2(v: impl Into<u16>) -> Self

Source

pub fn uint4(v: impl Into<u32>) -> Self

Source

pub fn uint8(v: impl Into<u64>) -> Self

Source

pub fn uint16(v: impl Into<u128>) -> Self

Source

pub fn date(v: impl Into<Date>) -> Self

Source

pub fn datetime(v: impl Into<DateTime>) -> Self

Source

pub fn time(v: impl Into<Time>) -> Self

Source

pub fn duration(v: impl Into<Duration>) -> Self

Source

pub fn row_number(v: impl Into<RowNumber>) -> Self

Source

pub fn identity_id(v: impl Into<IdentityId>) -> Self

Source

pub fn uuid4(v: impl Into<Uuid4>) -> Self

Source

pub fn uuid7(v: impl Into<Uuid7>) -> Self

Source

pub fn blob(v: impl Into<Blob>) -> Self

Source

pub fn any(v: impl Into<Value>) -> Self

Source§

impl Value

Source

pub fn get_type(&self) -> Type

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

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

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

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Value

Source§

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

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

impl From<&Value> for Type

Source§

fn from(value: &Value) -> Self

Converts to this type from the input type.
Source§

impl Hash for Value

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl IntoValue for Value

Source§

impl Ord for Value

Source§

fn cmp(&self, other: &Self) -> Ordering

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

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Value

Source§

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

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

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 PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Value

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFromValue for Value

Source§

fn try_from_value(value: &Value) -> Result<Self, FromValueError>

Attempt to extract a value of this type from a Value. Read more
Source§

fn from_value(value: &Value) -> Option<Self>

Extract from Value, returning None for Undefined or type mismatch. Read more
Source§

impl Eq for Value

Source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,