pub struct Slots(/* private fields */);
Expand description
Collection of slots, primarily for execution environment
Implementations§
Source§impl Slots
impl Slots
Sourcepub fn new<I>(slots: I) -> Selfwhere
I: IntoIterator<Item = Slot>,
pub fn new<I>(slots: I) -> Selfwhere
I: IntoIterator<Item = Slot>,
Create a new instance from a hashmap containing existing slots.
Only slots that are present in the input can be modified. The only exception is slots for
owners created during runtime and initialized with Self::add_new_contract()
.
“Empty” slots must still have a value in the form of an empty [SharedAlignedBuffer
].
Sourcepub fn new_nested_rw(&mut self) -> NestedSlots<'_>
pub fn new_nested_rw(&mut self) -> NestedSlots<'_>
Create a new nested read-write slots instance.
Nested instance will integrate its changes into the parent slot when dropped (or changes can
be reset with NestedSlots::reset()
).
Sourcepub fn new_nested_ro(&self) -> NestedSlots<'_>
pub fn new_nested_ro(&self) -> NestedSlots<'_>
Create a new nested read-only slots instance
Sourcepub fn add_new_contract(&mut self, owner: Address) -> bool
pub fn add_new_contract(&mut self, owner: Address) -> bool
Add a new contract that didn’t exist before.
In contrast to contracts in Self::new()
, this contract will be allowed to have any slots
related to it being modified.
Returns false
if a contract already exits in a map, which is also considered as an access
violation.
Sourcepub fn iter(
&self,
) -> impl ExactSizeIterator<Item = (&SlotKey, &SharedAlignedBuffer)> + '_
pub fn iter( &self, ) -> impl ExactSizeIterator<Item = (&SlotKey, &SharedAlignedBuffer)> + '_
Iterate over all slots in the collection
Sourcepub fn iter_modified(
&self,
) -> impl Iterator<Item = (&SlotKey, &SharedAlignedBuffer)> + '_
pub fn iter_modified( &self, ) -> impl Iterator<Item = (&SlotKey, &SharedAlignedBuffer)> + '_
Iterate over modified slots in the collection
Sourcepub fn into_slots(
self,
) -> impl ExactSizeIterator<Item = (SlotKey, SharedAlignedBuffer)>
pub fn into_slots( self, ) -> impl ExactSizeIterator<Item = (SlotKey, SharedAlignedBuffer)>
Extract all slots in the collection
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Slots
impl RefUnwindSafe for Slots
impl Send for Slots
impl Sync for Slots
impl Unpin for Slots
impl UnwindSafe for Slots
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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