pub struct Metadata { /* private fields */ }
Expand description
Metadata wrapper around the runtime metadata. Offers some extra features, such as direct pallets, events and error access.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn pallets(&self) -> impl Iterator<Item = PalletMetadata<'_>>
pub fn pallets(&self) -> impl Iterator<Item = PalletMetadata<'_>>
An iterator over all of the available pallets.
Sourcepub fn pallet_by_index(&self, variant_index: u8) -> Option<PalletMetadata<'_>>
pub fn pallet_by_index(&self, variant_index: u8) -> Option<PalletMetadata<'_>>
Access a pallet given its encoded variant index.
Sourcepub fn pallet_by_name(&self, pallet_name: &str) -> Option<PalletMetadata<'_>>
pub fn pallet_by_name(&self, pallet_name: &str) -> Option<PalletMetadata<'_>>
Access a pallet given its name.
Sourcepub fn ty(&self) -> &<PortableForm as Form>::Type
pub fn ty(&self) -> &<PortableForm as Form>::Type
Return the type of the Runtime
.
Sourcepub fn dispatch_error_ty(&self) -> Option<u32>
pub fn dispatch_error_ty(&self) -> Option<u32>
Return the DispatchError type ID if it exists.
Sourcepub fn types(&self) -> &PortableRegistry
pub fn types(&self) -> &PortableRegistry
Return the type registry embedded within the metadata.
Sourcepub fn resolve_type(&self, id: u32) -> Option<&Type<PortableForm>>
pub fn resolve_type(&self, id: u32) -> Option<&Type<PortableForm>>
Resolve a type definition.
Sourcepub fn runtime_metadata(&self) -> &RuntimeMetadataLastVersion
pub fn runtime_metadata(&self) -> &RuntimeMetadataLastVersion
Exposes the runtime metadata.
Sourcepub fn extrinsic(&self) -> &ExtrinsicMetadata<PortableForm>
pub fn extrinsic(&self) -> &ExtrinsicMetadata<PortableForm>
Return details about the extrinsic format.
Sourcepub fn runtime_api_traits(
&self,
) -> impl ExactSizeIterator<Item = RuntimeApiMetadata<'_>>
pub fn runtime_api_traits( &self, ) -> impl ExactSizeIterator<Item = RuntimeApiMetadata<'_>>
An iterator over all of the runtime APIs.
Sourcepub fn runtime_api_trait_by_name(
&self,
name: &str,
) -> Option<RuntimeApiMetadata<'_>>
pub fn runtime_api_trait_by_name( &self, name: &str, ) -> Option<RuntimeApiMetadata<'_>>
Access a runtime API trait given its name.
Sourcepub fn outer_enums(&self) -> &OuterEnums<PortableForm>
pub fn outer_enums(&self) -> &OuterEnums<PortableForm>
Return the outer enums types as found in the runtime.
Sourcepub fn custom(&self) -> &CustomMetadata<PortableForm>
pub fn custom(&self) -> &CustomMetadata<PortableForm>
Returns the custom types of the metadata.
pub fn pretty_format(&self) -> Result<String, FromUtf8Error>
Source§impl Metadata
Err wrappers around option.
impl Metadata
Err wrappers around option.
Sourcepub fn pallet_by_name_err(
&self,
name: &str,
) -> Result<PalletMetadata<'_>, MetadataError>
pub fn pallet_by_name_err( &self, name: &str, ) -> Result<PalletMetadata<'_>, MetadataError>
Identical to metadata.pallet_by_name()
, but returns an error if the pallet is not found.
Sourcepub fn pallet_by_index_err(
&self,
index: u8,
) -> Result<PalletMetadata<'_>, MetadataError>
pub fn pallet_by_index_err( &self, index: u8, ) -> Result<PalletMetadata<'_>, MetadataError>
Identical to metadata.pallet_by_index()
, but returns an error if the pallet is not found.
Sourcepub fn runtime_api_trait_by_name_err(
&self,
name: &str,
) -> Result<RuntimeApiMetadata<'_>, MetadataError>
pub fn runtime_api_trait_by_name_err( &self, name: &str, ) -> Result<RuntimeApiMetadata<'_>, MetadataError>
Identical to metadata.runtime_api_trait_by_name()
, but returns an error if the trait is not found.
Source§impl Metadata
Get the storage keys corresponding to a storage
impl Metadata
Get the storage keys corresponding to a storage
This is not part of subxt.
pub fn storage_value_key( &self, pallet: &'static str, storage_item: &'static str, ) -> Result<StorageKey, MetadataError>
pub fn storage_map_key<K: Encode>( &self, pallet: &'static str, storage_item: &'static str, map_key: K, ) -> Result<StorageKey, MetadataError>
pub fn storage_map_key_prefix( &self, pallet: &'static str, storage_item: &'static str, ) -> Result<StorageKey, MetadataError>
pub fn storage_double_map_key_prefix<K: Encode>( &self, storage_prefix: &'static str, storage_key_name: &'static str, first: K, ) -> Result<StorageKey, MetadataError>
pub fn storage_double_map_key<K: Encode, Q: Encode>( &self, pallet: &'static str, storage_item: &'static str, first_double_map_key: K, second_double_map_key: Q, ) -> Result<StorageKey, MetadataError>
Source§impl Metadata
impl Metadata
pub fn print_overview(&self)
pub fn print_pallets(&self)
pub fn print_pallets_with_calls(&self)
pub fn print_pallets_with_constants(&self)
pub fn print_pallet_with_storages(&self)
pub fn print_pallets_with_events(&self)
pub fn print_pallets_with_errors(&self)
Trait Implementations§
Source§impl Decode for Metadata
impl Decode for Metadata
Source§fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl Encode for Metadata
impl Encode for Metadata
Source§fn encode_to<T: Output + ?Sized>(&self, dest: &mut T)
fn encode_to<T: Output + ?Sized>(&self, dest: &mut T)
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl TryFrom<RuntimeMetadataPrefixed> for Metadata
impl TryFrom<RuntimeMetadataPrefixed> for Metadata
Source§type Error = MetadataConversionError
type Error = MetadataConversionError
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.