pub enum AlgebraicValue {
    Sum(SumValue),
    Product(ProductValue),
    Builtin(BuiltinValue),
}

Variants§

Implementations§

source§

impl AlgebraicValue

source

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

source

pub fn as_sum(&self) -> Option<&SumValue>

Optionally returns references to the inner fields if this is a AlgebraicValue::Sum, otherwise None

source

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

source

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

source

pub fn as_product(&self) -> Option<&ProductValue>

Optionally returns references to the inner fields if this is a AlgebraicValue::Product, otherwise None

source

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

source

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

source

pub fn as_builtin(&self) -> Option<&BuiltinValue>

Optionally returns references to the inner fields if this is a AlgebraicValue::Builtin, otherwise None

source

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

source

pub const UNIT: AlgebraicValue = AlgebraicValue::Product(ProductValue{ elements: Vec::new(),})

source

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

source

pub fn as_i8(&self) -> Option<&i8>

source

pub fn as_u8(&self) -> Option<&u8>

source

pub fn as_i16(&self) -> Option<&i16>

source

pub fn as_u16(&self) -> Option<&u16>

source

pub fn as_i32(&self) -> Option<&i32>

source

pub fn as_u32(&self) -> Option<&u32>

source

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

source

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

source

pub fn as_i128(&self) -> Option<&i128>

source

pub fn as_u128(&self) -> Option<&u128>

source

pub fn as_f32(&self) -> Option<&ConstrainedFloat<f32, UnitConstraint<f32>>>

source

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

source

pub fn as_string(&self) -> Option<&String>

source

pub fn as_bytes(&self) -> Option<&Vec<u8, Global>>

source

pub fn as_array(&self) -> Option<&ArrayValue>

source

pub fn as_map( &self ) -> Option<&BTreeMap<AlgebraicValue, AlgebraicValue, Global>>

source

pub fn into_bool(self) -> Result<bool, AlgebraicValue>

source

pub fn into_i8(self) -> Result<i8, AlgebraicValue>

source

pub fn into_u8(self) -> Result<u8, AlgebraicValue>

source

pub fn into_i16(self) -> Result<i16, AlgebraicValue>

source

pub fn into_u16(self) -> Result<u16, AlgebraicValue>

source

pub fn into_i32(self) -> Result<i32, AlgebraicValue>

source

pub fn into_u32(self) -> Result<u32, AlgebraicValue>

source

pub fn into_i64(self) -> Result<i64, AlgebraicValue>

source

pub fn into_u64(self) -> Result<u64, AlgebraicValue>

source

pub fn into_i128(self) -> Result<i128, AlgebraicValue>

source

pub fn into_u128(self) -> Result<u128, AlgebraicValue>

source

pub fn into_f32( self ) -> Result<ConstrainedFloat<f32, UnitConstraint<f32>>, AlgebraicValue>

source

pub fn into_f64( self ) -> Result<ConstrainedFloat<f64, UnitConstraint<f64>>, AlgebraicValue>

source

pub fn into_string(self) -> Result<String, AlgebraicValue>

source

pub fn into_bytes(self) -> Result<Vec<u8, Global>, AlgebraicValue>

source

pub fn into_array(self) -> Result<ArrayValue, AlgebraicValue>

source

pub fn into_map( self ) -> Result<BTreeMap<AlgebraicValue, AlgebraicValue, Global>, AlgebraicValue>

source

pub fn Bool(v: bool) -> AlgebraicValue

source

pub fn I8(v: i8) -> AlgebraicValue

source

pub fn U8(v: u8) -> AlgebraicValue

source

pub fn I16(v: i16) -> AlgebraicValue

source

pub fn U16(v: u16) -> AlgebraicValue

source

pub fn I32(v: i32) -> AlgebraicValue

source

pub fn U32(v: u32) -> AlgebraicValue

source

pub fn I64(v: i64) -> AlgebraicValue

source

pub fn U64(v: u64) -> AlgebraicValue

source

pub fn I128(v: i128) -> AlgebraicValue

source

pub fn U128(v: u128) -> AlgebraicValue

source

pub fn F32(v: ConstrainedFloat<f32, UnitConstraint<f32>>) -> AlgebraicValue

source

pub fn F64(v: ConstrainedFloat<f64, UnitConstraint<f64>>) -> AlgebraicValue

source

pub fn String(v: String) -> AlgebraicValue

source

pub fn Bytes(v: Vec<u8, Global>) -> AlgebraicValue

source

pub fn ArrayOf<T>(val: T) -> AlgebraicValuewhere T: Into<ArrayValue>,

source

pub fn OptionSome(v: AlgebraicValue) -> AlgebraicValue

source

pub fn OptionNone() -> AlgebraicValue

source

pub fn type_of(&self) -> AlgebraicType

Infer the AlgebraicType of Self.

source§

impl AlgebraicValue

source

pub fn decode<'a>( algebraic_type: &<AlgebraicValue as Value>::Type, bytes: &mut impl BufReader<'a> ) -> Result<AlgebraicValue, DecodeError>

source

pub fn encode(&self, bytes: &mut impl BufWriter)

Trait Implementations§

source§

impl Clone for AlgebraicValue

source§

fn clone(&self) -> AlgebraicValue

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 AlgebraicValue

source§

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

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

impl From<&[u8]> for AlgebraicValue

source§

fn from(x: &[u8]) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<&AlgebraicValue> for ProductValue

source§

fn from(x: &AlgebraicValue) -> ProductValue

Converts to this type from the input type.
source§

impl From<&str> for AlgebraicValue

source§

fn from(x: &str) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<AlgebraicValue> for ProductValue

source§

fn from(x: AlgebraicValue) -> ProductValue

Converts to this type from the input type.
source§

impl From<BuiltinValue> for AlgebraicValue

source§

fn from(value: BuiltinValue) -> AlgebraicValue

Converts to this type from the input type.
source§

impl<T> From<Option<T>> for AlgebraicValuewhere T: Into<AlgebraicValue>,

source§

fn from(value: Option<T>) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<ProductValue> for AlgebraicValue

source§

fn from(x: ProductValue) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<String> for AlgebraicValue

source§

fn from(x: String) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<bool> for AlgebraicValue

source§

fn from(x: bool) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<f32> for AlgebraicValue

source§

fn from(x: f32) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<f64> for AlgebraicValue

source§

fn from(x: f64) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<i128> for AlgebraicValue

source§

fn from(x: i128) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<i16> for AlgebraicValue

source§

fn from(x: i16) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<i32> for AlgebraicValue

source§

fn from(x: i32) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<i64> for AlgebraicValue

source§

fn from(x: i64) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<i8> for AlgebraicValue

source§

fn from(x: i8) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<u128> for AlgebraicValue

source§

fn from(x: u128) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<u16> for AlgebraicValue

source§

fn from(x: u16) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<u32> for AlgebraicValue

source§

fn from(x: u32) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<u64> for AlgebraicValue

source§

fn from(x: u64) -> AlgebraicValue

Converts to this type from the input type.
source§

impl From<u8> for AlgebraicValue

source§

fn from(x: u8) -> AlgebraicValue

Converts to this type from the input type.
source§

impl FromIterator<AlgebraicValue> for ProductValue

source§

fn from_iter<T>(iter: T) -> ProductValuewhere T: IntoIterator<Item = AlgebraicValue>,

Creates a value from an iterator. Read more
source§

impl Hash for AlgebraicValue

source§

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

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

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 Ord for AlgebraicValue

source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

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

impl PartialEq<AlgebraicValue> for AlgebraicValue

source§

fn eq(&self, other: &AlgebraicValue) -> 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<AlgebraicValue> for AlgebraicValue

source§

fn partial_cmp(&self, other: &AlgebraicValue) -> 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 AlgebraicValue

source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,

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

impl Serialize for AlgebraicValue

source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,

source§

impl ToDataKey for AlgebraicValue

source§

impl Value for AlgebraicValue

source§

impl Eq for AlgebraicValue

source§

impl StructuralEq for AlgebraicValue

source§

impl StructuralPartialEq for AlgebraicValue

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<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
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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> Satn for Twhere T: Serialize + ?Sized,

source§

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

source§

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

source§

fn to_satn(&self) -> String

source§

fn to_satn_pretty(&self) -> String

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.