Struct scrypto_test::prelude::Heap
source · pub struct Heap {
nodes: NonIterMap<NodeId, BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>>,
}
Fields§
§nodes: NonIterMap<NodeId, BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>>
Implementations§
source§impl Heap
impl Heap
pub fn new() -> Heap
pub fn is_empty(&self) -> bool
pub fn remove_partition<E, F>( &mut self, node_id: &NodeId, partition_number: PartitionNumber, on_io_access: &mut F ) -> Result<BTreeMap<SubstateKey, IndexedScryptoValue>, CallbackError<HeapRemovePartitionError, E>>
sourcepub fn get_substate(
&self,
node_id: &NodeId,
partition_num: PartitionNumber,
substate_key: &SubstateKey
) -> Option<&IndexedScryptoValue>
pub fn get_substate( &self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey ) -> Option<&IndexedScryptoValue>
Reads a substate
sourcepub fn set_substate<E, F>(
&mut self,
node_id: NodeId,
partition_number: PartitionNumber,
substate_key: SubstateKey,
substate_value: IndexedScryptoValue,
on_io_access: &mut F
) -> Result<(), E>
pub fn set_substate<E, F>( &mut self, node_id: NodeId, partition_number: PartitionNumber, substate_key: SubstateKey, substate_value: IndexedScryptoValue, on_io_access: &mut F ) -> Result<(), E>
Inserts or overwrites a substate
pub fn remove_substate<E, F>( &mut self, node_id: &NodeId, partition_number: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<IndexedScryptoValue>, E>
sourcepub fn scan_keys(
&self,
node_id: &NodeId,
partition_num: PartitionNumber,
count: u32
) -> Vec<SubstateKey>
pub fn scan_keys( &self, node_id: &NodeId, partition_num: PartitionNumber, count: u32 ) -> Vec<SubstateKey>
Scans the keys of a node’s partition. On an non-existing node/partition, this will return an empty vector
sourcepub fn drain_substates<E, F>(
&mut self,
node_id: &NodeId,
partition_number: PartitionNumber,
count: u32,
on_io_access: &mut F
) -> Result<Vec<(SubstateKey, IndexedScryptoValue)>, E>
pub fn drain_substates<E, F>( &mut self, node_id: &NodeId, partition_number: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(SubstateKey, IndexedScryptoValue)>, E>
Drains the substates from a node’s partition. On an non-existing node/partition, this will return an empty vector
sourcepub fn create_node<E, F>(
&mut self,
node_id: NodeId,
substates: BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>,
on_io_access: &mut F
) -> Result<(), E>
pub fn create_node<E, F>( &mut self, node_id: NodeId, substates: BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>, on_io_access: &mut F ) -> Result<(), E>
Inserts a new node to heap.
sourcepub fn remove_node<E, F>(
&mut self,
node_id: &NodeId,
on_io_access: &mut F
) -> Result<BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>, CallbackError<HeapRemoveNodeError, E>>
pub fn remove_node<E, F>( &mut self, node_id: &NodeId, on_io_access: &mut F ) -> Result<BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>, CallbackError<HeapRemoveNodeError, E>>
Removes node.
Auto Trait Implementations§
impl !RefUnwindSafe for Heap
impl Send for Heap
impl !Sync for Heap
impl Unpin for Heap
impl !UnwindSafe for Heap
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.