#[derive(StorageLayout)]
Expand description
Derives ink::storage
’s StorageLayout
trait for the given struct
or enum
.
§Examples
use ink_metadata::layout::Layout::Struct;
use ink::storage::traits::StorageLayout;
#[derive(StorageLayout)]
struct NamedFields {
a: u32,
b: [u32; 32],
}
let key = 0x123;
let mut value = NamedFields {
a: 123,
b: [22; 32],
};
if let Struct(layout) = <NamedFields as StorageLayout>::layout(&key) {
assert_eq!(*layout.fields()[0].name(), "a");
assert_eq!(*layout.fields()[1].name(), "b");
}