Trait KVReconstruct

Source
pub trait KVReconstruct: Sized {
    // Required method
    fn reconstruct(kvs: &[StorageValue]) -> NeutronResult<Self>;
}
Expand description

A data structure that can be reconstructed from slice of StorageValue structures. Neutron provides KVReconstruct for many primitive and standard Cosmos-SDK types and query responses.

Third-party projects may provide KVReconstruct implementations for types that they introduce. For example if some query is not implemented in Neutron standard library, developers can create their own type/query and implement KVReconstruct for it.

Usually used together with query_kv_result function. For example, there is an Interchain Query with some query_id to query balance from remote chain. And there is an implemented KVReconstruct for Balance structure. So you can easily get reconstructed response for the query just in one line:

let balances: Balances = query_kv_result(deps, query_id)?;

Anyone can implement KVReconstruct for any type and use query_kv_result without any problems.

Required Methods§

Source

fn reconstruct(kvs: &[StorageValue]) -> NeutronResult<Self>

Reconstructs this value from the slice of StorageValue’s.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl KVReconstruct for Uint128

Implementors§

Source§

impl KVReconstruct for neutron_sdk::interchain_queries::v045::types::Balances

Source§

impl KVReconstruct for neutron_sdk::interchain_queries::v045::types::Delegations

Source§

impl KVReconstruct for FeePool

Source§

impl KVReconstruct for GovernmentProposal

Source§

impl KVReconstruct for GovernmentProposalVotes

Source§

impl KVReconstruct for SigningInfo

Source§

impl KVReconstruct for StakingValidator

Source§

impl KVReconstruct for TotalSupply

Source§

impl KVReconstruct for UnbondingDelegations

Source§

impl KVReconstruct for neutron_sdk::interchain_queries::v047::types::Balances

Source§

impl KVReconstruct for neutron_sdk::interchain_queries::v047::types::Delegations