pub trait QueryKindTrait<Value, OnEmpty> {
    type Query: FullCodec + 'static;

    const METADATA: StorageEntryModifierIR;

    // Required methods
    fn from_optional_value_to_query(v: Option<Value>) -> Self::Query;
    fn from_query_to_optional_value(v: Self::Query) -> Option<Value>;
}
Expand description

Trait implementing how the storage optional value is converted into the queried type.

It is implemented by:

  • OptionQuery which converts an optional value to an optional value, used when querying storage returns an optional value.
  • ResultQuery which converts an optional value to a result value, used when querying storage returns a result value.
  • ValueQuery which converts an optional value to a value, used when querying storage returns a value.

Required Associated Types§

source

type Query: FullCodec + 'static

Type returned on query

Required Associated Constants§

source

const METADATA: StorageEntryModifierIR

Metadata for the storage kind.

Required Methods§

source

fn from_optional_value_to_query(v: Option<Value>) -> Self::Query

Convert an optional value (i.e. some if trie contains the value or none otherwise) to the query.

source

fn from_query_to_optional_value(v: Self::Query) -> Option<Value>

Convert a query to an optional value.

Implementors§

source§

impl<Value> QueryKindTrait<Value, GetDefault> for OptionQuerywhere Value: FullCodec + 'static,

source§

const METADATA: StorageEntryModifierIR = StorageEntryModifierIR::Optional

§

type Query = Option<Value>

source§

impl<Value, Error, OnEmpty> QueryKindTrait<Value, OnEmpty> for ResultQuery<Error>where Value: FullCodec + 'static, Error: FullCodec + 'static, OnEmpty: Get<Result<Value, Error>>,

source§

const METADATA: StorageEntryModifierIR = StorageEntryModifierIR::Optional

§

type Query = Result<Value, Error>

source§

impl<Value, OnEmpty> QueryKindTrait<Value, OnEmpty> for ValueQuerywhere Value: FullCodec + 'static, OnEmpty: Get<Value>,

source§

const METADATA: StorageEntryModifierIR = StorageEntryModifierIR::Default

§

type Query = Value