[−][src]Struct substrate_frame_rpc_support::StorageQuery
A typed query on chain state usable from an RPC client.
pub type Loc = (i64, i64, i64); pub type Block = u8; // Note that all fields are marked pub. decl_storage! { trait Store for Module<T: Trait> as TestRuntime { pub LastActionId: u64; pub Voxels: map hasher(blake2_128_concat) Loc => Block; pub Actions: map hasher(blake2_128_concat) u64 => Loc; pub Prefab: double_map hasher(blake2_128_concat) u128, hasher(blake2_128_concat) (i8, i8, i8) => Block; } } let conn = http::connect("http://[::1]:9933").compat().await?; let cl = StateClient::<Hash>::new(conn); let q = StorageQuery::value::<LastActionId>(); let _: Option<u64> = q.get(&cl, None).await?; let q = StorageQuery::map::<Voxels, _>((0, 0, 0)); let _: Option<Block> = q.get(&cl, None).await?; let q = StorageQuery::map::<Actions, _>(12); let _: Option<Loc> = q.get(&cl, None).await?; let q = StorageQuery::double_map::<Prefab, _, _>(3, (0, 0, 0)); let _: Option<Block> = q.get(&cl, None).await?;
Implementations
impl<V: FullCodec> StorageQuery<V>
[src]
pub fn value<St: StorageValue<V>>() -> Self
[src]
Create a storage query for a StorageValue.
pub fn map<St: StorageMap<K, V>, K: FullEncode>(key: K) -> Self
[src]
Create a storage query for a value in a StorageMap.
pub fn double_map<St: StorageDoubleMap<K1, K2, V>, K1: FullEncode, K2: FullEncode>(
key1: K1,
key2: K2
) -> Self
[src]
key1: K1,
key2: K2
) -> Self
Create a storage query for a value in a StorageDoubleMap.
pub async fn get<Hash: Send + Sync + 'static + DeserializeOwned + Serialize, '_>(
self,
state_client: &'_ StateClient<Hash>,
block_index: Option<Hash>
) -> Result<Option<V>, RpcError>
[src]
self,
state_client: &'_ StateClient<Hash>,
block_index: Option<Hash>
) -> Result<Option<V>, RpcError>
Send this query over RPC, await the typed result.
Hash should be
Arguments
state_client represents a connection to the RPC server.
block_index indicates the block for which state will be queried. A value of None indicates the latest block.
Trait Implementations
impl<V: Clone> Clone for StorageQuery<V>
[src]
fn clone(&self) -> StorageQuery<V>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<V: Debug> Debug for StorageQuery<V>
[src]
impl<V: Eq> Eq for StorageQuery<V>
[src]
impl<V: Hash> Hash for StorageQuery<V>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<V: Ord> Ord for StorageQuery<V>
[src]
fn cmp(&self, other: &StorageQuery<V>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<V: PartialEq> PartialEq<StorageQuery<V>> for StorageQuery<V>
[src]
fn eq(&self, other: &StorageQuery<V>) -> bool
[src]
fn ne(&self, other: &StorageQuery<V>) -> bool
[src]
impl<V: PartialOrd> PartialOrd<StorageQuery<V>> for StorageQuery<V>
[src]
fn partial_cmp(&self, other: &StorageQuery<V>) -> Option<Ordering>
[src]
fn lt(&self, other: &StorageQuery<V>) -> bool
[src]
fn le(&self, other: &StorageQuery<V>) -> bool
[src]
fn gt(&self, other: &StorageQuery<V>) -> bool
[src]
fn ge(&self, other: &StorageQuery<V>) -> bool
[src]
impl<V> StructuralEq for StorageQuery<V>
[src]
impl<V> StructuralPartialEq for StorageQuery<V>
[src]
Auto Trait Implementations
impl<V> RefUnwindSafe for StorageQuery<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> Send for StorageQuery<V> where
V: Send,
V: Send,
impl<V> Sync for StorageQuery<V> where
V: Sync,
V: Sync,
impl<V> Unpin for StorageQuery<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for StorageQuery<V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Self: TryFrom<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Self: TryInto<T>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
fn from_ref(t: &T) -> &T
[src]
fn into_ref(&self) -> &T
[src]
fn from_mut(t: &mut T) -> &mut T
[src]
fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
fn from_ref(outer: &Outer) -> &T
Get a reference to the inner from the outer.
fn from_mut(outer: &mut Outer) -> &mut T
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeHash for T where
T: Hash,
T: Hash,
impl<T> MaybeHash for T where
T: Hash,
T: Hash,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
T: UncheckedFrom<S>,
fn unchecked_into(self) -> T
impl<T, S> UniqueSaturatedInto<T> for S where
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
T: Bounded,
fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,