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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T.