Skip to main content

Expression

Enum Expression 

Source
pub enum Expression {
Show 42 variants Literal { value: RuntimeValue, }, Var { name: String, }, Default { of_type: TypeDescriptor, }, If { cond: Box<Expression>, then: Box<Expression>, else: Box<Expression>, }, EltRef { value: Box<Expression>, field: String, index: IntLit, }, EnumRef { of_type: TypeDescriptor, variant: String, }, Tuple { items: Vec<TupleItem>, }, Vector { items: Vec<TupleItem>, }, TupleRef { value: Box<Expression>, index: IntLit, }, TupleSlice { value: Box<Expression>, start: IntLit, length: IntLit, result_type: TypeDescriptor, }, VectorRef { value: Box<Expression>, index: Box<Expression>, result_type: TypeDescriptor, }, VectorSlice { value: Box<Expression>, start: Box<Expression>, length: IntLit, result_type: TypeDescriptor, }, BytesRef { value: Box<Expression>, index: Box<Expression>, result_type: TypeDescriptor, }, BytesSlice { value: Box<Expression>, start: Box<Expression>, length: IntLit, result_type: TypeDescriptor, }, Binop { op: String, bits: Option<u32>, of_type: Option<TypeDescriptor>, left: Box<Expression>, right: Box<Expression>, }, Eq { of_type: Option<TypeDescriptor>, left: Box<Expression>, right: Box<Expression>, }, Neq { of_type: Option<TypeDescriptor>, left: Box<Expression>, right: Box<Expression>, }, And { left: Box<Expression>, right: Box<Expression>, }, Or { left: Box<Expression>, right: Box<Expression>, }, Not { value: Box<Expression>, }, Assign { name: String, value: Box<Expression>, }, Call { function: String, function_uniq: Option<u64>, arguments: Vec<Expression>, }, New { of_type: TypeDescriptor, arguments: Vec<Expression>, }, Seq { items: Vec<Expression>, }, Cast { to: TypeDescriptor, value: Box<Expression>, }, SafeCast { to: TypeDescriptor, from: TypeDescriptor, value: Box<Expression>, }, DowncastUnsigned { from_bits: Option<IntLit>, to_bits: IntLit, value: Box<Expression>, }, FieldToBytes { length: u32, field_type: Option<FieldType>, value: Box<Expression>, }, CastToField { field_type: FieldType, from: TypeDescriptor, value: Box<Expression>, }, CastFromField { maxval: IntLit, field_type: FieldType, value: Box<Expression>, }, Emit { event_version: u32, event_tag: u32, payload_length: u32, payload: Box<Expression>, vm_ops: Vec<VmInstr>, }, CastFromBytes { to: TypeDescriptor, length: u32, value: Box<Expression>, }, VectorToBytes { length: u32, value: Box<Expression>, }, BytesToVector { length: u32, value: Box<Expression>, }, CastFromEnum { from: TypeDescriptor, to: TypeDescriptor, value: Box<Expression>, }, CastToEnum { from: TypeDescriptor, to: TypeDescriptor, value: Box<Expression>, }, Assert { cond: Box<Expression>, message: String, }, Map { length: IntLit, function: RuntimeValue, arguments: Vec<RuntimeValue>, }, Fold { length: IntLit, function: RuntimeValue, initial: RuntimeValue, arguments: Vec<RuntimeValue>, }, AdtOp(AdtOpInvocation), ContractCall { circuit: String, address: Box<Expression>, address_type: TypeDescriptor, arguments: Vec<Expression>, }, Unimplemented,
}

Variants§

§

Literal

Fields

§

Var

Fields

§name: String
§

Default

Fields

§

If

Fields

§

EltRef

Fields

§field: String
§index: IntLit
§

EnumRef

Fields

§variant: String
§

Tuple

Fields

§

Vector

Fields

§

TupleRef

Fields

§index: IntLit
§

TupleSlice

Fields

§start: IntLit
§length: IntLit
§result_type: TypeDescriptor
§

VectorRef

Fields

§result_type: TypeDescriptor
§

VectorSlice

Fields

§length: IntLit
§result_type: TypeDescriptor
§

BytesRef

Fields

§result_type: TypeDescriptor
§

BytesSlice

Fields

§length: IntLit
§result_type: TypeDescriptor
§

Binop

Fields

§bits: Option<u32>

Operand width for the comparisons (<, <=, >, >=).

§of_type: Option<TypeDescriptor>

Operand type for the arithmetic ops (+, -, *). Since 0.33 these carry a full type rather than a width, because a curve field wraps at its own modulus — the type is what selects the implementation.

§

Eq

§

Neq

§

And

Fields

§

Or

Fields

§

Not

Fields

§

Assign

Fields

§name: String
§

Call

Fields

§function: String
§function_uniq: Option<u64>

Optional disambiguator for monomorphized generics — the patched compactc fork emits function-uniq: <number> so consumers can pick the right instantiation among multiple circuits sharing the same source-level name. Older fixtures don’t carry this field; consumers fall back to “first match by name” when absent.

§arguments: Vec<Expression>
§

New

Fields

§arguments: Vec<Expression>
§

Seq

Fields

§

Cast

§

SafeCast

§

DowncastUnsigned

Fields

§from_bits: Option<IntLit>
§to_bits: IntLit
§

FieldToBytes

Fields

§length: u32
§field_type: Option<FieldType>

Which field the operand is drawn from. Absent in schema 1, where the only field was the native one.

§

CastToField

Widen a value into a field element. field-type names the target field, from the operand’s type.

Fields

§field_type: FieldType
§

CastFromField

Narrow a field element to a Uint bounded by maxval, failing if the value does not fit.

Fields

§maxval: IntLit
§field_type: FieldType
§

Emit

Emit a contract event (MIP-0002). payload evaluates to the serialized bytes; vm-ops is the ledger-query sequence that records the event, matching what the TypeScript emitter runs.

Fields

§event_version: u32
§event_tag: u32
§payload_length: u32
§payload: Box<Expression>
§vm_ops: Vec<VmInstr>
§

CastFromBytes

Fields

§length: u32
§

VectorToBytes

Fields

§length: u32
§

BytesToVector

Fields

§length: u32
§

CastFromEnum

§

CastToEnum

§

Assert

Fields

§message: String
§

Map

Fields

§length: IntLit
§function: RuntimeValue
§arguments: Vec<RuntimeValue>
§

Fold

Fields

§length: IntLit
§function: RuntimeValue
§arguments: Vec<RuntimeValue>
§

AdtOp(AdtOpInvocation)

§

ContractCall

Fields

§circuit: String
§address: Box<Expression>
§address_type: TypeDescriptor
§arguments: Vec<Expression>
§

Unimplemented

Sentinel for unimplemented expression (development-time only).

Trait Implementations§

Source§

impl Clone for Expression

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Expression

Source§

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

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

impl<'de> Deserialize<'de> for Expression

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 Serialize for Expression

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

Auto Trait Implementations§

§

impl Forget for Expression

§

impl Freeze for Expression

§

impl Move for Expression

§

impl RefUnwindSafe for Expression

§

impl Send for Expression
where RawVecInner: Send, NodeRef<Owned, String, RuntimeValue, LeafOrInternal>: Send, BoxRaw<(String, RuntimeValue)>: Send, BoxRaw<TypeDescriptor>: Send, BoxRaw<Expression>: Send,

§

impl Sync for Expression
where RawVecInner: Sync, NodeRef<Owned, String, RuntimeValue, LeafOrInternal>: Sync, BoxRaw<(String, RuntimeValue)>: Sync, BoxRaw<TypeDescriptor>: Sync, BoxRaw<Expression>: Sync,

§

impl Unpin for Expression

§

impl UnsafeUnpin for Expression

§

impl UnwindSafe for Expression

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.