pub enum CellExpression {
Deref(CellRef),
DoubleDeref(CellRef, i16),
Immediate(BigInt),
BinOp {
op: CellOperator,
a: CellRef,
b: DerefOrImmediate,
},
}Expand description
The expression representing a cell in the casm memory.
Variants§
Deref(CellRef)
DoubleDeref(CellRef, i16)
Represents an expression of the form [[cell_ref] + offset].
Immediate(BigInt)
BinOp
Represents an expression of the form [cell_ref] + [cell_ref] or [cell_ref] + imm.
If op is CellOperator::Div, b must not be zero.
Implementations§
source§impl CellExpression
impl CellExpression
pub fn from_res_operand(operand: ResOperand) -> Self
sourcepub fn to_deref_or_immediate(&self) -> Option<DerefOrImmediate>
pub fn to_deref_or_immediate(&self) -> Option<DerefOrImmediate>
Extract a deref or immediate from the cell expression.
sourcepub fn to_deref_with_offset(&self) -> Option<(CellRef, i16)>
pub fn to_deref_with_offset(&self) -> Option<(CellRef, i16)>
Given [ref] + offset returns ([ref], offset).
sourcepub fn to_buffer(&self, required_slack: i16) -> Option<CellExpression>
pub fn to_buffer(&self, required_slack: i16) -> Option<CellExpression>
Returns the reference as a buffer with at least required_slack next cells that can be
written as an instruction offset.
Trait Implementations§
source§impl ApplyApChange for CellExpression
impl ApplyApChange for CellExpression
source§fn apply_known_ap_change(self, ap_change: usize) -> Option<Self>
fn apply_known_ap_change(self, ap_change: usize) -> Option<Self>
Attempts to apply ap change, fail on overflow only.
source§fn can_apply_unknown(&self) -> bool
fn can_apply_unknown(&self) -> bool
Can unknown ap change be applied.
source§fn apply_ap_change(self, ap_change: ApChange) -> Result<Self, ApChangeError>
fn apply_ap_change(self, ap_change: ApChange) -> Result<Self, ApChangeError>
Attempts to apply ap change.
source§fn unchecked_apply_known_ap_change(self, ap_change: usize) -> Self
fn unchecked_apply_known_ap_change(self, ap_change: usize) -> Self
Same as Self::apply_known_ap_change but unchecked.
source§impl Clone for CellExpression
impl Clone for CellExpression
source§fn clone(&self) -> CellExpression
fn clone(&self) -> CellExpression
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 CellExpression
impl Debug for CellExpression
source§impl Display for CellExpression
impl Display for CellExpression
source§impl PartialEq for CellExpression
impl PartialEq for CellExpression
impl Eq for CellExpression
impl StructuralPartialEq for CellExpression
Auto Trait Implementations§
impl Freeze for CellExpression
impl RefUnwindSafe for CellExpression
impl Send for CellExpression
impl Sync for CellExpression
impl Unpin for CellExpression
impl UnwindSafe for CellExpression
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more