Struct ink_primitives::KeyComposer
source · pub struct KeyComposer;
Expand description
Contains all rules related to storage key creation.
Implementations§
source§impl KeyComposer
impl KeyComposer
sourcepub const fn concat(left: Key, right: Key) -> Key
pub const fn concat(left: Key, right: Key) -> Key
Concatenate two Key
into one during compilation.
sourcepub const fn from_bytes(bytes: &[u8]) -> Key
pub const fn from_bytes(bytes: &[u8]) -> Key
Returns the storage key from the supplied bytes
.
sourcepub fn compute_key(
struct_name: &str,
variant_name: &str,
field_name: &str,
) -> Result<Key, Error>
pub fn compute_key( struct_name: &str, variant_name: &str, field_name: &str, ) -> Result<Key, Error>
Evaluates the storage key of the field in the structure, variant or union.
- Compute the ASCII byte representation of
struct_name
and call itS
. - If
variant_name
is not empty then computes the ASCII byte representation and call itV
. 1. Compute the ASCII byte representation offield_name
and call itF
. 1. Concatenate (S
andF
) or (S
,V
andF
) using::
as separator and call itC
. 1. TheXXH32
hash ofC
is the storage key.
§Note
variant_name
is empty for structures and unions.- if the field is unnamed then
field_name
is"{}"
where{}
is a number of the field.
Auto Trait Implementations§
impl Freeze for KeyComposer
impl RefUnwindSafe for KeyComposer
impl Send for KeyComposer
impl Sync for KeyComposer
impl Unpin for KeyComposer
impl UnwindSafe for KeyComposer
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