Enum cairo_vm::types::relocatable::MaybeRelocatable
source · pub enum MaybeRelocatable {
RelocatableValue(Relocatable),
Int(Felt),
}Variants§
RelocatableValue(Relocatable)
Int(Felt)
Implementations§
source§impl MaybeRelocatable
impl MaybeRelocatable
sourcepub fn add_int(
&self,
other: &Felt
) -> Result<MaybeRelocatable, VirtualMachineError>
pub fn add_int(
&self,
other: &Felt
) -> Result<MaybeRelocatable, VirtualMachineError>
Adds a Felt to self
sourcepub fn add_usize(&self, other: usize) -> MaybeRelocatable
pub fn add_usize(&self, other: usize) -> MaybeRelocatable
Adds a usize to self
sourcepub fn add(
&self,
other: &MaybeRelocatable
) -> Result<MaybeRelocatable, VirtualMachineError>
pub fn add(
&self,
other: &MaybeRelocatable
) -> Result<MaybeRelocatable, VirtualMachineError>
Adds a MaybeRelocatable to self Cant add two relocatable values
sourcepub fn sub(
&self,
other: &MaybeRelocatable
) -> Result<MaybeRelocatable, VirtualMachineError>
pub fn sub(
&self,
other: &MaybeRelocatable
) -> Result<MaybeRelocatable, VirtualMachineError>
Substracts two MaybeRelocatable values and returns the result as a MaybeRelocatable value. Only values of the same type may be substracted. Relocatable values can only be substracted if they belong to the same segment.
sourcepub fn divmod(
&self,
other: &MaybeRelocatable
) -> Result<(MaybeRelocatable, MaybeRelocatable), VirtualMachineError>
pub fn divmod(
&self,
other: &MaybeRelocatable
) -> Result<(MaybeRelocatable, MaybeRelocatable), VirtualMachineError>
Performs integer division and module on a MaybeRelocatable::Int by another MaybeRelocatable::Int and returns the quotient and reminder.
pub fn get_int_ref(&self) -> Result<&Felt, VirtualMachineError>
pub fn get_relocatable(&self) -> Result<Relocatable, VirtualMachineError>
Trait Implementations§
source§impl Clone for MaybeRelocatable
impl Clone for MaybeRelocatable
source§fn clone(&self) -> MaybeRelocatable
fn clone(&self) -> MaybeRelocatable
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 MaybeRelocatable
impl Debug for MaybeRelocatable
source§impl<'de> Deserialize<'de> for MaybeRelocatable
impl<'de> Deserialize<'de> for MaybeRelocatable
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 Display for MaybeRelocatable
impl Display for MaybeRelocatable
source§impl From<&Felt> for MaybeRelocatable
impl From<&Felt> for MaybeRelocatable
source§impl From<&MaybeRelocatable> for MaybeRelocatable
impl From<&MaybeRelocatable> for MaybeRelocatable
source§fn from(other: &MaybeRelocatable) -> Self
fn from(other: &MaybeRelocatable) -> Self
Converts to this type from the input type.
source§impl From<&Relocatable> for MaybeRelocatable
impl From<&Relocatable> for MaybeRelocatable
source§fn from(rel: &Relocatable) -> Self
fn from(rel: &Relocatable) -> Self
Converts to this type from the input type.
source§impl From<Felt> for MaybeRelocatable
impl From<Felt> for MaybeRelocatable
source§impl From<MaybeRelocatable> for CairoArg
impl From<MaybeRelocatable> for CairoArg
source§fn from(other: MaybeRelocatable) -> Self
fn from(other: MaybeRelocatable) -> Self
Converts to this type from the input type.
source§impl From<Relocatable> for MaybeRelocatable
impl From<Relocatable> for MaybeRelocatable
source§fn from(rel: Relocatable) -> Self
fn from(rel: Relocatable) -> Self
Converts to this type from the input type.
source§impl From<usize> for MaybeRelocatable
impl From<usize> for MaybeRelocatable
source§impl Hash for MaybeRelocatable
impl Hash for MaybeRelocatable
source§impl PartialEq<MaybeRelocatable> for MaybeRelocatable
impl PartialEq<MaybeRelocatable> for MaybeRelocatable
source§fn eq(&self, other: &MaybeRelocatable) -> bool
fn eq(&self, other: &MaybeRelocatable) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd<MaybeRelocatable> for MaybeRelocatable
impl PartialOrd<MaybeRelocatable> for MaybeRelocatable
source§fn partial_cmp(&self, other: &MaybeRelocatable) -> Option<Ordering>
fn partial_cmp(&self, other: &MaybeRelocatable) -> Option<Ordering>
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 MaybeRelocatable
impl Serialize for MaybeRelocatable
source§impl TryFrom<&MaybeRelocatable> for Relocatable
impl TryFrom<&MaybeRelocatable> for Relocatable
§type Error = MemoryError
type Error = MemoryError
The type returned in the event of a conversion error.
source§fn try_from(other: &MaybeRelocatable) -> Result<Self, MemoryError>
fn try_from(other: &MaybeRelocatable) -> Result<Self, MemoryError>
Performs the conversion.
source§impl TryInto<Relocatable> for MaybeRelocatable
impl TryInto<Relocatable> for MaybeRelocatable
§type Error = MemoryError
type Error = MemoryError
The type returned in the event of a conversion error.
source§fn try_into(self) -> Result<Relocatable, MemoryError>
fn try_into(self) -> Result<Relocatable, MemoryError>
Performs the conversion.
impl Eq for MaybeRelocatable
impl StructuralEq for MaybeRelocatable
impl StructuralPartialEq for MaybeRelocatable
Auto Trait Implementations§
impl RefUnwindSafe for MaybeRelocatable
impl Send for MaybeRelocatable
impl Sync for MaybeRelocatable
impl Unpin for MaybeRelocatable
impl UnwindSafe for MaybeRelocatable
Blanket Implementations§
source§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,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.