#[non_exhaustive]
pub enum FieldValue { Null, Int64(i64), Uint64(u64), Float64(f64), String(Arc<str>), Boolean(bool), Enum(Arc<str>), List(Arc<[FieldValue]>), }
Expand description

Values of fields in Trustfall.

For version that is serialized as an untagged enum, see TransparentValue.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Null

§

Int64(i64)

Together with Uint64, corresponds to schemas’ Int type.

§

Uint64(u64)

Together with Int64, corresponds to schemas’ Int type.

§

Float64(f64)

Corresponds to schemas’ Float type. Not allowed to be NaN or infinite.

§

String(Arc<str>)

§

Boolean(bool)

§

Enum(Arc<str>)

§

List(Arc<[FieldValue]>)

Implementations§

source§

impl FieldValue

source

pub const NULL: Self = FieldValue::Null

source§

impl FieldValue

source

pub fn as_i64(&self) -> Option<i64>

source

pub fn as_u64(&self) -> Option<u64>

source

pub fn as_usize(&self) -> Option<usize>

source

pub fn as_f64(&self) -> Option<f64>

source

pub fn as_str(&self) -> Option<&str>

source

pub fn as_arc_str(&self) -> Option<&Arc<str>>

source

pub fn as_bool(&self) -> Option<bool>

source

pub fn as_slice(&self) -> Option<&[FieldValue]>

source

pub fn as_arc_slice(&self) -> Option<&Arc<[FieldValue]>>

source

pub fn as_vec_with<'a, T>( &'a self, inner: impl Fn(&'a FieldValue) -> Option<T> ) -> Option<Vec<T>>

Trait Implementations§

source§

impl AsRef<FieldValue> for FieldValue

source§

fn as_ref(&self) -> &FieldValue

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for FieldValue

source§

fn clone(&self) -> FieldValue

Returns a copy 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 Debug for FieldValue

source§

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

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

impl Default for &FieldValue

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Default for FieldValue

source§

fn default() -> FieldValue

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for FieldValue

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<T: Into<FieldValue> + Clone> From<&[T]> for FieldValue

source§

fn from(slice: &[T]) -> FieldValue

Converts to this type from the input type.
source§

impl From<&String> for FieldValue

source§

fn from(v: &String) -> Self

Converts to this type from the input type.
source§

impl From<&str> for FieldValue

source§

fn from(v: &str) -> Self

Converts to this type from the input type.
source§

impl From<Arc<str>> for FieldValue

source§

fn from(v: Arc<str>) -> Self

Converts to this type from the input type.
source§

impl From<FieldValue> for TransparentValue

source§

fn from(value: FieldValue) -> Self

Converts to this type from the input type.
source§

impl From<FiniteF64> for FieldValue

source§

fn from(f: FiniteF64) -> FieldValue

Converts to this type from the input type.
source§

impl<T: Into<FieldValue>> From<Option<T>> for FieldValue

source§

fn from(opt: Option<T>) -> FieldValue

Converts to this type from the input type.
source§

impl From<String> for FieldValue

source§

fn from(v: String) -> Self

Converts to this type from the input type.
source§

impl From<TransparentValue> for FieldValue

source§

fn from(value: TransparentValue) -> Self

Converts to this type from the input type.
source§

impl<T: Into<FieldValue>> From<Vec<T>> for FieldValue

source§

fn from(vec: Vec<T>) -> FieldValue

Converts to this type from the input type.
source§

impl From<bool> for FieldValue

source§

fn from(v: bool) -> Self

Converts to this type from the input type.
source§

impl From<i16> for FieldValue

source§

fn from(v: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for FieldValue

source§

fn from(v: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for FieldValue

source§

fn from(v: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for FieldValue

source§

fn from(v: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for FieldValue

source§

fn from(v: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for FieldValue

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for FieldValue

source§

fn from(v: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for FieldValue

source§

fn from(v: u8) -> Self

Converts to this type from the input type.
source§

impl<T: Into<FieldValue>> FromIterator<T> for FieldValue

source§

fn from_iter<I>(iter: I) -> Selfwhere I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
source§

impl PartialEq for FieldValue

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for FieldValue

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 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

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

impl Serialize for FieldValue

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 TryFrom<ConstValue> for FieldValue

§

type Error = String

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

fn try_from(value: ConstValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Option<f32>> for FieldValue

§

type Error = (f32, &'static str)

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

fn try_from(value: Option<f32>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Option<f64>> for FieldValue

§

type Error = (f64, &'static str)

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

fn try_from(value: Option<f64>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for FieldValue

§

type Error = String

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

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for FieldValue

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<V> AsVertex<V> for Vwhere V: Debug + Clone,

source§

fn as_vertex(&self) -> Option<&V>

Dereference this value into a &V, if the value happens to contain a V. Read more
source§

fn into_vertex(self) -> Option<V>

Consume self and produce the contained V, if one was indeed present. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
source§

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