Struct sway_types::state::StateIndex
source · [−]pub struct StateIndex(_);
Expand description
Represents the position in a storage statement that a field was declared.
For example, in the following storage declaration, foo
has StateIndex 0 and bar
has
StateIndex 1.
The actual [StorageSlot] is calculated as the sha256 hash of the domain separator [sway_utils::constants::STORAGE_DOMAIN_SEPARATOR] concatenated with the index.
Here, foo
’s [StorageSlot] is sha256(format!("{}{}", STORAGE_DOMAIN_SEPARATOR, 0))
or
F383B0CE51358BE57DAA3B725FE44ACDB2D880604E367199080B4379C41BB6ED
.
bar
’s [StorageSlot] is sha256(format!("{}{}", STORAGE_DOMAIN_SEPARATOR, 1))
or
DE9090CB50E71C2588C773487D1DA7066D0C719849A7E58DC8B6397A25C567C0
.
Implementations
Trait Implementations
sourceimpl Clone for StateIndex
impl Clone for StateIndex
sourcefn clone(&self) -> StateIndex
fn clone(&self) -> StateIndex
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StateIndex
impl Debug for StateIndex
sourceimpl PartialEq<StateIndex> for StateIndex
impl PartialEq<StateIndex> for StateIndex
sourcefn eq(&self, other: &StateIndex) -> bool
fn eq(&self, other: &StateIndex) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Copy for StateIndex
impl Eq for StateIndex
impl StructuralEq for StateIndex
impl StructuralPartialEq for StateIndex
Auto Trait Implementations
impl RefUnwindSafe for StateIndex
impl Send for StateIndex
impl Sync for StateIndex
impl Unpin for StateIndex
impl UnwindSafe for StateIndex
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more