Luke Schoen
Luke Schoen

Reputation: 4513

What is an example of a `storage_name` in decl_storage

It says that decl_storage! is a "procedural macro" used for storing data to make it available in subsequent blocks.

At that link there's a sentence that says Basic storage consists of a name and a type. It then shows the different supported types, including the most basic supported type, which just contains a "Value" that appears to correspond to the "storage name" of Foo. This line of the "Example" module of the SRML also matches this pattern.

It then shows how the hashing algorithms are used to hash a combination of values, including the storage_name. The storage_name that's shown appears to correspond to a "storage name" such a Foo that was shown earlier on that page.

Then there's a sentence that says Basic storage can be extended as such:, it shows a pattern ... #name ..., and describes it as #name: Name of the storage item, used as a prefix in storage., which appears to correspond to a "storage name" such as Foo that was shown earlier on the page, and both #name and #type are not labelled as [optional] because they are not "extensions" to basic storage, that are fundamental to basic storage

Is Foo supposed to be an example of a storage_name that may be used with decl_storage!?

Upvotes: 1

Views: 128

Answers (1)

gui
gui

Reputation: 516

Yes Foo is an example of a storage name that can be used in decl_storage!.

All rust ident should be usable as a storage name in decl_storage I think.

(Indeed the documentation is mixing example and definition, sometimes using u32 sometimes type for example)

Upvotes: 2

Related Questions