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§
source§impl Clone for StateIndex
impl Clone for StateIndex
source§fn clone(&self) -> StateIndex
fn clone(&self) -> StateIndex
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StateIndex
impl Debug for StateIndex
source§impl Hash for StateIndex
impl Hash for StateIndex
source§impl PartialEq<StateIndex> for StateIndex
impl PartialEq<StateIndex> for StateIndex
source§fn 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 ==
.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§
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
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more