pub struct Memory {
pub data: Vec<Vec<Option<MaybeRelocatable>>>,
pub temp_data: Vec<Vec<Option<MaybeRelocatable>>>,
pub validated_addresses: HashSet<MaybeRelocatable>,
/* private fields */
}Fields§
§data: Vec<Vec<Option<MaybeRelocatable>>>§temp_data: Vec<Vec<Option<MaybeRelocatable>>>§validated_addresses: HashSet<MaybeRelocatable>Implementations§
source§impl Memory
impl Memory
pub fn new() -> Memory
sourcepub fn insert<'a, K: 'a, V: 'a>(
&mut self,
key: &'a K,
val: &'a V
) -> Result<(), MemoryError>where
Relocatable: TryFrom<&'a K>,
MaybeRelocatable: From<&'a K> + From<&'a V>,
pub fn insert<'a, K: 'a, V: 'a>(
&mut self,
key: &'a K,
val: &'a V
) -> Result<(), MemoryError>where
Relocatable: TryFrom<&'a K>,
MaybeRelocatable: From<&'a K> + From<&'a V>,
Inserts an MaybeRelocatable value into an address given by a MaybeRelocatable::Relocatable Will panic if the segment index given by the address corresponds to a non-allocated segment If the address isnt contiguous with previously inserted data, memory gaps will be represented by inserting None values
sourcepub fn relocate_memory(&mut self) -> Result<(), MemoryError>
pub fn relocate_memory(&mut self) -> Result<(), MemoryError>
Relocates the memory according to the relocation rules and clears self.relocaction_rules.
pub fn get_integer(
&self,
key: &Relocatable
) -> Result<Cow<'_, Felt>, VirtualMachineError>
pub fn get_relocatable(
&self,
key: &Relocatable
) -> Result<Relocatable, VirtualMachineError>
pub fn insert_value<T: Into<MaybeRelocatable>>(
&mut self,
key: &Relocatable,
val: T
) -> Result<(), VirtualMachineError>
pub fn add_validation_rule(&mut self, segment_index: usize, rule: ValidationRule)
sourcepub fn validate_existing_memory(&mut self) -> Result<(), MemoryError>
pub fn validate_existing_memory(&mut self) -> Result<(), MemoryError>
Applies validation_rules to the current memory