mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 03:18:01 +00:00
Get workspace compiling via 'cargo check'
This commit is contained in:
@@ -25,6 +25,7 @@ mod utils;
|
||||
use alloc::borrow::Cow;
|
||||
use alloc::collections::BTreeMap;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::sync::Arc;
|
||||
use alloc::vec::Vec;
|
||||
use frame_decode::constants::{ConstantEntry, ConstantInfo, ConstantInfoError};
|
||||
use frame_decode::custom_values::{CustomValue, CustomValueInfo, CustomValueInfoError};
|
||||
@@ -58,6 +59,9 @@ pub use from::legacy::Error as LegacyFromError;
|
||||
|
||||
type CustomMetadataInner = frame_metadata::v15::CustomMetadata<PortableForm>;
|
||||
|
||||
/// Metadata is often passed around wrapped in an [`Arc`] so that it can be cheaply cloned.
|
||||
pub type ArcMetadata = Arc<Metadata>;
|
||||
|
||||
/// Node metadata. This can be constructed by providing some compatible [`frame_metadata`]
|
||||
/// which is then decoded into this. We aim to preserve all of the existing information in
|
||||
/// the incoming metadata while optimizing the format a little for Subxt's use cases.
|
||||
@@ -370,6 +374,12 @@ impl frame_decode::custom_values::CustomValueEntryInfo for Metadata {
|
||||
}
|
||||
|
||||
impl Metadata {
|
||||
/// Metadata tends to be passed around wrapped in an [`Arc`] so that it can be
|
||||
/// cheaply cloned. This is a shorthand to return that.
|
||||
pub fn arc(self) -> ArcMetadata {
|
||||
Arc::new(self)
|
||||
}
|
||||
|
||||
/// This is essentially an alias for `<Metadata as codec::Decode>::decode(&mut bytes)`
|
||||
pub fn decode_from(mut bytes: &[u8]) -> Result<Self, codec::Error> {
|
||||
<Self as codec::Decode>::decode(&mut bytes)
|
||||
|
||||
Reference in New Issue
Block a user