Enum trustfall_core::ir::value::FieldValue
source · #[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
impl FieldValue
source§impl FieldValue
impl FieldValue
pub fn as_i64(&self) -> Option<i64>
pub fn as_u64(&self) -> Option<u64>
pub fn as_usize(&self) -> Option<usize>
pub fn as_f64(&self) -> Option<f64>
pub fn as_str(&self) -> Option<&str>
pub fn as_arc_str(&self) -> Option<&Arc<str>>
pub fn as_bool(&self) -> Option<bool>
pub fn as_slice(&self) -> Option<&[FieldValue]>
pub fn as_arc_slice(&self) -> Option<&Arc<[FieldValue]>>
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
impl AsRef<FieldValue> for FieldValue
source§fn as_ref(&self) -> &FieldValue
fn as_ref(&self) -> &FieldValue
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for FieldValue
impl Clone for FieldValue
source§fn clone(&self) -> FieldValue
fn clone(&self) -> FieldValue
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FieldValue
impl Debug for FieldValue
source§impl Default for &FieldValue
impl Default for &FieldValue
source§impl Default for FieldValue
impl Default for FieldValue
source§fn default() -> FieldValue
fn default() -> FieldValue
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for FieldValue
impl<'de> Deserialize<'de> for FieldValue
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
impl<T: Into<FieldValue> + Clone> From<&[T]> for FieldValue
source§fn from(slice: &[T]) -> FieldValue
fn from(slice: &[T]) -> FieldValue
Converts to this type from the input type.
source§impl From<&String> for FieldValue
impl From<&String> for FieldValue
source§impl From<&str> for FieldValue
impl From<&str> for FieldValue
source§impl From<FieldValue> for TransparentValue
impl From<FieldValue> for TransparentValue
source§fn from(value: FieldValue) -> Self
fn from(value: FieldValue) -> Self
Converts to this type from the input type.
source§impl From<FiniteF64> for FieldValue
impl From<FiniteF64> for FieldValue
source§fn from(f: FiniteF64) -> FieldValue
fn from(f: FiniteF64) -> FieldValue
Converts to this type from the input type.
source§impl<T: Into<FieldValue>> From<Option<T>> for FieldValue
impl<T: Into<FieldValue>> From<Option<T>> for FieldValue
source§fn from(opt: Option<T>) -> FieldValue
fn from(opt: Option<T>) -> FieldValue
Converts to this type from the input type.
source§impl From<String> for FieldValue
impl From<String> for FieldValue
source§impl From<TransparentValue> for FieldValue
impl From<TransparentValue> for FieldValue
source§fn from(value: TransparentValue) -> Self
fn from(value: TransparentValue) -> Self
Converts to this type from the input type.
source§impl<T: Into<FieldValue>> From<Vec<T>> for FieldValue
impl<T: Into<FieldValue>> From<Vec<T>> for FieldValue
source§fn from(vec: Vec<T>) -> FieldValue
fn from(vec: Vec<T>) -> FieldValue
Converts to this type from the input type.
source§impl From<bool> for FieldValue
impl From<bool> for FieldValue
source§impl From<i16> for FieldValue
impl From<i16> for FieldValue
source§impl From<i32> for FieldValue
impl From<i32> for FieldValue
source§impl From<i64> for FieldValue
impl From<i64> for FieldValue
source§impl From<i8> for FieldValue
impl From<i8> for FieldValue
source§impl From<u16> for FieldValue
impl From<u16> for FieldValue
source§impl From<u32> for FieldValue
impl From<u32> for FieldValue
source§impl From<u64> for FieldValue
impl From<u64> for FieldValue
source§impl From<u8> for FieldValue
impl From<u8> for FieldValue
source§impl<T: Into<FieldValue>> FromIterator<T> for FieldValue
impl<T: Into<FieldValue>> FromIterator<T> for FieldValue
source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> Selfwhere I: IntoIterator<Item = T>,
Creates a value from an iterator. Read more
source§impl PartialEq for FieldValue
impl PartialEq for FieldValue
source§impl PartialOrd for FieldValue
impl PartialOrd for FieldValue
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl Serialize for FieldValue
impl Serialize for FieldValue
source§impl TryFrom<ConstValue> for FieldValue
impl TryFrom<ConstValue> for FieldValue
source§impl TryFrom<Value> for FieldValue
impl TryFrom<Value> for FieldValue
impl Eq for FieldValue
Auto Trait Implementations§
impl RefUnwindSafe for FieldValue
impl Send for FieldValue
impl Sync for FieldValue
impl Unpin for FieldValue
impl UnwindSafe for FieldValue
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
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,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
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,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.