Struct Slots

Source
pub struct Slots(/* private fields */);
Expand description

Collection of slots, primarily for execution environment

Implementations§

Source§

impl Slots

Source

pub fn new<I>(slots: I) -> Self
where 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].

Source

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()).

Source

pub fn new_nested_ro(&self) -> NestedSlots<'_>

Create a new nested read-only slots instance

Source

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.

Source

pub fn iter( &self, ) -> impl ExactSizeIterator<Item = (&SlotKey, &SharedAlignedBuffer)> + '_

Iterate over all slots in the collection

Source

pub fn iter_modified( &self, ) -> impl Iterator<Item = (&SlotKey, &SharedAlignedBuffer)> + '_

Iterate over modified slots in the collection

Source

pub fn into_slots( self, ) -> impl ExactSizeIterator<Item = (SlotKey, SharedAlignedBuffer)>

Extract all slots in the collection

Trait Implementations§

Source§

impl Clone for Slots

Source§

fn clone(&self) -> Slots

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Slots

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more