-
Notifications
You must be signed in to change notification settings - Fork 480
Storage refactoring new hope for review #1331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2b26752
8dbf040
341c48b
346529c
b731f92
d6db8de
f967986
fc3fcb0
8f511ec
7e094eb
8c9942d
9188ca7
7375b4c
906b1d8
290b384
1f7603f
09c24e1
07a71ea
07889af
f64d7f7
efff8bf
556ce20
5ce970d
8fcdab2
ca9f95b
8eb4cb9
66a6901
8854be8
15563de
4f35230
5065b07
3247ee2
63e3909
c07b471
72c84a8
cad9234
7371905
477e4cf
235d649
8b9ccbc
a42bc9d
be1563e
300b139
7b8733d
3e3fbd7
5808157
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,11 @@ use self::{ | |
| }; | ||
| synstructure::decl_derive!( | ||
| [Item] => | ||
| /// Derives `ink_storage`'s `Item` trait for the given `struct` or `enum`. | ||
| /// Derives `ink_storage`'s [`Item`](ink_storage::traits::Item) trait for the given `struct` | ||
| /// or `enum`. | ||
| /// | ||
| /// If the type declaration contains generic [`StorageKey`](ink_storage::traits::StorageKey), | ||
| /// it will use it as salt to generate a combined storage key. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
|
|
@@ -55,23 +59,13 @@ synstructure::decl_derive!( | |
| /// | ||
| /// let _: NamedFields = <NamedFields as Item<AutoKey>>::Type::default(); | ||
| /// let _: NamedFields = <NamedFields as Item<ManualKey<123>>>::Type::default(); | ||
| /// | ||
| /// #[derive(Item, StorageKey, Storable)] | ||
| /// struct NamedFieldsStorage<KEY: ink_storage::traits::StorageKey> { | ||
| /// a: <u32 as AutoItem<ManualKey<0, KEY>>>::Type, | ||
| /// b: <[u32; 32] as AutoItem<ManualKey<1, KEY>>>::Type, | ||
| /// } | ||
| /// | ||
| /// // (AutoKey | ManualKey<123>) -> ManualKey<123> | ||
| /// assert_eq!(123, <NamedFieldsStorage<AutoKey> as AutoItem<ManualKey<123>>>::Type::KEY); | ||
| /// // (ManualKey<321> | ManualKey<123>) -> ManualKey<321> | ||
| /// assert_eq!(321, <NamedFieldsStorage<ManualKey<321>> as AutoItem<ManualKey<123>>>::Type::KEY); | ||
| /// ``` | ||
| item_derive | ||
| ); | ||
| synstructure::decl_derive!( | ||
| [StorageKey] => | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this exposed publicly? When would a user need to derive this for this manually? I imagine its public because the codegen needs to pull it in is some capacity, but not sure if users need to know about its existence
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The user can manually implement each trait or some traits. It is why |
||
| /// Derives `ink_storage`'s `StorageKey` trait for the given `struct` or `enum`. | ||
| /// Derives `ink_storage`'s [`StorageKey`](ink_storage::traits::StorageKey) trait for the given | ||
athei marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// `struct` or `enum`. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
|
|
@@ -105,7 +99,8 @@ synstructure::decl_derive!( | |
| ); | ||
| synstructure::decl_derive!( | ||
| [StorageLayout] => | ||
| /// Derives `ink_storage`'s `StorageLayout` trait for the given `struct` or `enum`. | ||
| /// Derives `ink_storage`'s [`StorageKey`](ink_storage::traits::StorageLayout) trait for the | ||
| /// given `struct` or `enum`. | ||
HCastano marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// | ||
| /// # Examples | ||
| /// | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.