In the tutorial of learning substrate, a storage map for stored items is defined as follows, in which the symbol => appears, but this specification is not in the standard syntax of rust. How to understand it?

MyMap get(my_map): map u8 => Vec<u8>;
  • 1
    Could you also link to the substrate docs in question - for reference.
    – Rtsne42
    Apr 4, 2022 at 11:37

1 Answer 1


It's not standard Rust syntax because it makes use of the #[pallet::storage] macro. Please have a look at the official documentation for the macro and the StorageMap type for more information.

In short,

#[pallet::getter(fn some_map)]
pub(super) type SomeMap<T: Config> = StorageMap<_, Blake2_128Concat, SomeKey, SomeValue, ValueQuery>;

sets up a StorageMap with name SomeMap for SomeKey => SomeValue with getter function some_map using the Blake2_128Concat hasher. ValueQuery states that the resulting value lookup is not wrapped into an Option, which would be the case if you were using OptionQuery (default implementation of the QueryKind generic).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.