Enum spacetimedb_lib::AlgebraicValue
source · pub enum AlgebraicValue {
Sum(SumValue),
Product(ProductValue),
Builtin(BuiltinValue),
}
Variants§
Implementations§
source§impl AlgebraicValue
impl AlgebraicValue
sourcepub fn as_sum_mut(&mut self) -> Option<&mut SumValue>
pub fn as_sum_mut(&mut self) -> Option<&mut SumValue>
Optionally returns mutable references to the inner fields if this is a AlgebraicValue::Sum
, otherwise None
sourcepub fn as_sum(&self) -> Option<&SumValue>
pub fn as_sum(&self) -> Option<&SumValue>
Optionally returns references to the inner fields if this is a AlgebraicValue::Sum
, otherwise None
sourcepub fn into_sum(self) -> Result<SumValue, AlgebraicValue>
pub fn into_sum(self) -> Result<SumValue, AlgebraicValue>
Returns the inner fields if this is a AlgebraicValue::Sum
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_product_mut(&mut self) -> Option<&mut ProductValue>
pub fn as_product_mut(&mut self) -> Option<&mut ProductValue>
Optionally returns mutable references to the inner fields if this is a AlgebraicValue::Product
, otherwise None
sourcepub fn as_product(&self) -> Option<&ProductValue>
pub fn as_product(&self) -> Option<&ProductValue>
Optionally returns references to the inner fields if this is a AlgebraicValue::Product
, otherwise None
sourcepub fn into_product(self) -> Result<ProductValue, AlgebraicValue>
pub fn into_product(self) -> Result<ProductValue, AlgebraicValue>
Returns the inner fields if this is a AlgebraicValue::Product
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_builtin_mut(&mut self) -> Option<&mut BuiltinValue>
pub fn as_builtin_mut(&mut self) -> Option<&mut BuiltinValue>
Optionally returns mutable references to the inner fields if this is a AlgebraicValue::Builtin
, otherwise None
sourcepub fn as_builtin(&self) -> Option<&BuiltinValue>
pub fn as_builtin(&self) -> Option<&BuiltinValue>
Optionally returns references to the inner fields if this is a AlgebraicValue::Builtin
, otherwise None
sourcepub fn into_builtin(self) -> Result<BuiltinValue, AlgebraicValue>
pub fn into_builtin(self) -> Result<BuiltinValue, AlgebraicValue>
Returns the inner fields if this is a AlgebraicValue::Builtin
, otherwise returns back the enum in the Err
case of the result
source§impl AlgebraicValue
impl AlgebraicValue
pub const UNIT: AlgebraicValue = AlgebraicValue::Product(ProductValue{ elements: Vec::new(),})
pub fn as_bool(&self) -> Option<&bool>
pub fn as_i8(&self) -> Option<&i8>
pub fn as_u8(&self) -> Option<&u8>
pub fn as_i16(&self) -> Option<&i16>
pub fn as_u16(&self) -> Option<&u16>
pub fn as_i32(&self) -> Option<&i32>
pub fn as_u32(&self) -> Option<&u32>
pub fn as_i64(&self) -> Option<&i64>
pub fn as_u64(&self) -> Option<&u64>
pub fn as_i128(&self) -> Option<&i128>
pub fn as_u128(&self) -> Option<&u128>
pub fn as_f32(&self) -> Option<&ConstrainedFloat<f32, UnitConstraint<f32>>>
pub fn as_f64(&self) -> Option<&ConstrainedFloat<f64, UnitConstraint<f64>>>
pub fn as_string(&self) -> Option<&String>
pub fn as_bytes(&self) -> Option<&Vec<u8, Global>>
pub fn as_array(&self) -> Option<&ArrayValue>
pub fn as_map( &self ) -> Option<&BTreeMap<AlgebraicValue, AlgebraicValue, Global>>
pub fn into_bool(self) -> Result<bool, AlgebraicValue>
pub fn into_i8(self) -> Result<i8, AlgebraicValue>
pub fn into_u8(self) -> Result<u8, AlgebraicValue>
pub fn into_i16(self) -> Result<i16, AlgebraicValue>
pub fn into_u16(self) -> Result<u16, AlgebraicValue>
pub fn into_i32(self) -> Result<i32, AlgebraicValue>
pub fn into_u32(self) -> Result<u32, AlgebraicValue>
pub fn into_i64(self) -> Result<i64, AlgebraicValue>
pub fn into_u64(self) -> Result<u64, AlgebraicValue>
pub fn into_i128(self) -> Result<i128, AlgebraicValue>
pub fn into_u128(self) -> Result<u128, AlgebraicValue>
pub fn into_f32( self ) -> Result<ConstrainedFloat<f32, UnitConstraint<f32>>, AlgebraicValue>
pub fn into_f64( self ) -> Result<ConstrainedFloat<f64, UnitConstraint<f64>>, AlgebraicValue>
pub fn into_string(self) -> Result<String, AlgebraicValue>
pub fn into_bytes(self) -> Result<Vec<u8, Global>, AlgebraicValue>
pub fn into_array(self) -> Result<ArrayValue, AlgebraicValue>
pub fn into_map( self ) -> Result<BTreeMap<AlgebraicValue, AlgebraicValue, Global>, AlgebraicValue>
pub fn Bool(v: bool) -> AlgebraicValue
pub fn I8(v: i8) -> AlgebraicValue
pub fn U8(v: u8) -> AlgebraicValue
pub fn I16(v: i16) -> AlgebraicValue
pub fn U16(v: u16) -> AlgebraicValue
pub fn I32(v: i32) -> AlgebraicValue
pub fn U32(v: u32) -> AlgebraicValue
pub fn I64(v: i64) -> AlgebraicValue
pub fn U64(v: u64) -> AlgebraicValue
pub fn I128(v: i128) -> AlgebraicValue
pub fn U128(v: u128) -> AlgebraicValue
pub fn F32(v: ConstrainedFloat<f32, UnitConstraint<f32>>) -> AlgebraicValue
pub fn F64(v: ConstrainedFloat<f64, UnitConstraint<f64>>) -> AlgebraicValue
pub fn String(v: String) -> AlgebraicValue
pub fn Bytes(v: Vec<u8, Global>) -> AlgebraicValue
pub fn ArrayOf<T>(val: T) -> AlgebraicValuewhere T: Into<ArrayValue>,
pub fn OptionSome(v: AlgebraicValue) -> AlgebraicValue
pub fn OptionNone() -> AlgebraicValue
sourcepub fn type_of(&self) -> AlgebraicType
pub fn type_of(&self) -> AlgebraicType
Infer the AlgebraicType of Self.
source§impl AlgebraicValue
impl AlgebraicValue
pub fn decode<'a>( algebraic_type: &<AlgebraicValue as Value>::Type, bytes: &mut impl BufReader<'a> ) -> Result<AlgebraicValue, DecodeError>
pub fn encode(&self, bytes: &mut impl BufWriter)
Trait Implementations§
source§impl Clone for AlgebraicValue
impl Clone for AlgebraicValue
source§fn clone(&self) -> AlgebraicValue
fn clone(&self) -> AlgebraicValue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AlgebraicValue
impl Debug for AlgebraicValue
source§impl From<&[u8]> for AlgebraicValue
impl From<&[u8]> for AlgebraicValue
source§fn from(x: &[u8]) -> AlgebraicValue
fn from(x: &[u8]) -> AlgebraicValue
source§impl From<&AlgebraicValue> for ProductValue
impl From<&AlgebraicValue> for ProductValue
source§fn from(x: &AlgebraicValue) -> ProductValue
fn from(x: &AlgebraicValue) -> ProductValue
source§impl From<&str> for AlgebraicValue
impl From<&str> for AlgebraicValue
source§fn from(x: &str) -> AlgebraicValue
fn from(x: &str) -> AlgebraicValue
source§impl From<AlgebraicValue> for ProductValue
impl From<AlgebraicValue> for ProductValue
source§fn from(x: AlgebraicValue) -> ProductValue
fn from(x: AlgebraicValue) -> ProductValue
source§impl From<BuiltinValue> for AlgebraicValue
impl From<BuiltinValue> for AlgebraicValue
source§fn from(value: BuiltinValue) -> AlgebraicValue
fn from(value: BuiltinValue) -> AlgebraicValue
source§impl<T> From<Option<T>> for AlgebraicValuewhere
T: Into<AlgebraicValue>,
impl<T> From<Option<T>> for AlgebraicValuewhere T: Into<AlgebraicValue>,
source§fn from(value: Option<T>) -> AlgebraicValue
fn from(value: Option<T>) -> AlgebraicValue
source§impl From<ProductValue> for AlgebraicValue
impl From<ProductValue> for AlgebraicValue
source§fn from(x: ProductValue) -> AlgebraicValue
fn from(x: ProductValue) -> AlgebraicValue
source§impl From<String> for AlgebraicValue
impl From<String> for AlgebraicValue
source§fn from(x: String) -> AlgebraicValue
fn from(x: String) -> AlgebraicValue
source§impl From<bool> for AlgebraicValue
impl From<bool> for AlgebraicValue
source§fn from(x: bool) -> AlgebraicValue
fn from(x: bool) -> AlgebraicValue
source§impl From<f32> for AlgebraicValue
impl From<f32> for AlgebraicValue
source§fn from(x: f32) -> AlgebraicValue
fn from(x: f32) -> AlgebraicValue
source§impl From<f64> for AlgebraicValue
impl From<f64> for AlgebraicValue
source§fn from(x: f64) -> AlgebraicValue
fn from(x: f64) -> AlgebraicValue
source§impl From<i128> for AlgebraicValue
impl From<i128> for AlgebraicValue
source§fn from(x: i128) -> AlgebraicValue
fn from(x: i128) -> AlgebraicValue
source§impl From<i16> for AlgebraicValue
impl From<i16> for AlgebraicValue
source§fn from(x: i16) -> AlgebraicValue
fn from(x: i16) -> AlgebraicValue
source§impl From<i32> for AlgebraicValue
impl From<i32> for AlgebraicValue
source§fn from(x: i32) -> AlgebraicValue
fn from(x: i32) -> AlgebraicValue
source§impl From<i64> for AlgebraicValue
impl From<i64> for AlgebraicValue
source§fn from(x: i64) -> AlgebraicValue
fn from(x: i64) -> AlgebraicValue
source§impl From<i8> for AlgebraicValue
impl From<i8> for AlgebraicValue
source§fn from(x: i8) -> AlgebraicValue
fn from(x: i8) -> AlgebraicValue
source§impl From<u128> for AlgebraicValue
impl From<u128> for AlgebraicValue
source§fn from(x: u128) -> AlgebraicValue
fn from(x: u128) -> AlgebraicValue
source§impl From<u16> for AlgebraicValue
impl From<u16> for AlgebraicValue
source§fn from(x: u16) -> AlgebraicValue
fn from(x: u16) -> AlgebraicValue
source§impl From<u32> for AlgebraicValue
impl From<u32> for AlgebraicValue
source§fn from(x: u32) -> AlgebraicValue
fn from(x: u32) -> AlgebraicValue
source§impl From<u64> for AlgebraicValue
impl From<u64> for AlgebraicValue
source§fn from(x: u64) -> AlgebraicValue
fn from(x: u64) -> AlgebraicValue
source§impl From<u8> for AlgebraicValue
impl From<u8> for AlgebraicValue
source§fn from(x: u8) -> AlgebraicValue
fn from(x: u8) -> AlgebraicValue
source§impl FromIterator<AlgebraicValue> for ProductValue
impl FromIterator<AlgebraicValue> for ProductValue
source§fn from_iter<T>(iter: T) -> ProductValuewhere
T: IntoIterator<Item = AlgebraicValue>,
fn from_iter<T>(iter: T) -> ProductValuewhere T: IntoIterator<Item = AlgebraicValue>,
source§impl Hash for AlgebraicValue
impl Hash for AlgebraicValue
source§impl Ord for AlgebraicValue
impl Ord for AlgebraicValue
source§fn cmp(&self, other: &AlgebraicValue) -> Ordering
fn cmp(&self, other: &AlgebraicValue) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<AlgebraicValue> for AlgebraicValue
impl PartialEq<AlgebraicValue> for AlgebraicValue
source§fn eq(&self, other: &AlgebraicValue) -> bool
fn eq(&self, other: &AlgebraicValue) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<AlgebraicValue> for AlgebraicValue
impl PartialOrd<AlgebraicValue> for AlgebraicValue
source§fn partial_cmp(&self, other: &AlgebraicValue) -> Option<Ordering>
fn partial_cmp(&self, other: &AlgebraicValue) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more