Fix linked map for trait types and Option#1809
Conversation
gui1117
left a comment
There was a problem hiding this comment.
also maybe it would be good to have a quick test on Option storage also, as logic differ a bit.
| mod #internal_module { | ||
| use super::*; | ||
| let helpers = quote! { | ||
| #[derive(parity_codec_derive::Encode, parity_codec_derive::Decode)] |
There was a problem hiding this comment.
diff --git a/srml/example/src/lib.rs b/srml/example/src/lib.rs
index fbd40318..888cd25a 100644
--- a/srml/example/src/lib.rs
+++ b/srml/example/src/lib.rs
@@ -62,6 +62,7 @@ decl_storage! {
// equipped with `fn getter_name() -> Type` for basic value items or
// `fn getter_name(key: KeyType) -> ValueType` for map items.
Dummy get(dummy) config(): Option<T::Balance>;
+ Dummy2 get(dummy) config(): linked_map T::Balance => Option<T::Balance>;
// this one uses the default, we'll demonstrate the usage of 'mutate' API.
Foo get(foo) config(): T::Balance;result in
error[E0433]: failed to resolve: use of undeclared type or module `parity_codec_derive`
--> srml/example/src/lib.rs:36:1
|
36 | / decl_storage! {
37 | | // A macro for the Storage trait, and its implementation, for this module.
38 | | // This allows for type-safe usage of the Substrate storage database, so you can
39 | | // keep things around between blocks.
... |
69 | | }
70 | | }
| |_^ use of undeclared type or module `parity_codec_derive`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
error: Could not compile `srml-example`.probably #scrate::parity_codec_derive::Encode and same Decode would fix it
There was a problem hiding this comment.
Yes but because of the module created the modified example still fails I don't really know why.
|
I saw your renaming, I wonder those function should be private isn't it ? |
|
@thiolliere I've added the internal module back and the helper functions are now part of the |
* Fix linked map for traits. * Fix Option<_> variant. * Improve naming a tad * Rebuild runtime * Encapsulate private data in the inner module. * Bump impl version. * Fix deriving codec in srml-example. * Fix derivation without importing parity-codec-derive. * Fix config() for map.
Fixes linked map in cases like
linked map: T::Balance => Option<T::Balance>Some groundwork was done by @thiolliere already in #1800, it also contains a bit more improvements over the impl.