-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Syntax improvement for ResultQuery usage #259
Description
paritytech/substrate#11257 introduces ResultQuery, which contain syntax that is in fact non-standard Rust when trying to use it as the QueryKind type parameter for a storage map. Example:
pub type Map3<T> = StorageMap<
_,
Blake2_128Concat,
u32,
u64,
ResultQuery<Error<T>::NonExistentStorageValue>, // <---- This is non-standard Rust syntax
>;The reason here is because Error<T>::NonExistentStorageValue is not a type, but rather a value, as enum variants are currently not properly recognized as their own proper types in Rust.
In addition, such a syntax does not cater to enum variants that accept fields, so implementors are forced to also use the OnEmpty parameter to specify what the default Result value should be when the corresponding value doesn't exist under the storage key specified.
We'd like to try and stick with standard Rust syntax as much as possible, and as a stretch goal, also allow for the flexibility of specifying the default query value without the usage of OnEmpty.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status