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_nameand call itS. - If
variant_nameis not empty then computes the ASCII byte representation and call itV. 1. Compute the ASCII byte representation offield_nameand call itF. 1. Concatenate (SandF) or (S,VandF) using::as separator and call itC. 1. TheXXH32hash ofCis the storage key.
§Note
variant_nameis empty for structures and unions.- if the field is unnamed then
field_nameis"{}"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