mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 00:37:57 +00:00
making some progress...
This commit is contained in:
Generated
+1
@@ -4535,6 +4535,7 @@ dependencies = [
|
||||
"base58",
|
||||
"bitvec",
|
||||
"blake2",
|
||||
"cfg-if",
|
||||
"derivative",
|
||||
"derive_more",
|
||||
"frame-metadata 16.0.0",
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ impl-serde = { version = "0.4.0" }
|
||||
indoc = "2"
|
||||
jsonrpsee = { version = "0.21" }
|
||||
pretty_assertions = "1.4.0"
|
||||
primitive-types = { version = "0.12.2", default-features = false, features = ["codec", "scale-info", "serde"] }
|
||||
primitive-types = { version = "0.12.2", default-features = false, features = ["codec", "scale-info", "serde_no_std"] }
|
||||
proc-macro-error = "1.0.4"
|
||||
proc-macro2 = "1.0.78"
|
||||
quote = "1.0.35"
|
||||
|
||||
+9
-8
@@ -15,21 +15,21 @@ description = "Sign extrinsics to be submitted by Subxt"
|
||||
keywords = ["parity", "subxt", "extrinsic", "no-std"]
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
# default = ["std"]
|
||||
std = []
|
||||
substrate-compat = ["sp-core", "sp-runtime"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
codec = { package = "parity-scale-codec", workspace = true, features = ["derive"] }
|
||||
scale-info = { workspace = true }
|
||||
scale-value = { workspace = true }
|
||||
scale-bits = { workspace = true }
|
||||
scale-decode = { workspace = true }
|
||||
scale-encode = { workspace = true }
|
||||
scale-info = { workspace = true, default-features = false, features = ["bitvec"] }
|
||||
scale-value = { workspace = true, default-features = false }
|
||||
scale-bits = { workspace = true, default-features = false }
|
||||
scale-decode = { workspace = true, default-features = false }
|
||||
scale-encode = { workspace = true, default-features = false }
|
||||
frame-metadata = { workspace = true }
|
||||
subxt-metadata = { workspace = true }
|
||||
derivative = { workspace = true }
|
||||
derivative = { workspace = true, features = ["use_core"] }
|
||||
derive_more = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
@@ -41,7 +41,7 @@ blake2 = { workspace = true }
|
||||
|
||||
# Provides some deserialization, types like U256/H256 and hashing impls like twox/blake256:
|
||||
impl-serde = { workspace = true }
|
||||
primitive-types = { workspace = true }
|
||||
primitive-types = { workspace = true, default-features = false, features = ["codec", "serde_no_std", "scale-info"] }
|
||||
sp-core-hashing = { workspace = true }
|
||||
|
||||
# For parsing urls to disallow insecure schemes
|
||||
@@ -50,6 +50,7 @@ url = { workspace = true }
|
||||
# Included if the "substrate-compat" feature is enabled.
|
||||
sp-core = { workspace = true, optional = true }
|
||||
sp-runtime = { workspace = true, optional = true }
|
||||
cfg-if = "1.0.0"
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
Generated
+34
-62
@@ -204,9 +204,6 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"rand",
|
||||
"rustc-hex",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
@@ -264,17 +261,6 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.3"
|
||||
@@ -413,12 +399,6 @@ version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "primitive-types"
|
||||
version = "0.12.2"
|
||||
@@ -476,42 +456,6 @@ version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hex"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
@@ -742,9 +686,11 @@ version = "0.34.0"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"blake2",
|
||||
"cfg-if",
|
||||
"derivative",
|
||||
"derive_more",
|
||||
"frame-metadata 16.0.0",
|
||||
"hex",
|
||||
"impl-serde",
|
||||
"parity-scale-codec",
|
||||
"primitive-types",
|
||||
@@ -756,6 +702,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sp-core-hashing",
|
||||
"subxt-metadata",
|
||||
"url",
|
||||
]
|
||||
|
||||
@@ -769,6 +716,17 @@ dependencies = [
|
||||
"subxt-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subxt-metadata"
|
||||
version = "0.34.0"
|
||||
dependencies = [
|
||||
"frame-metadata 16.0.0",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"sp-core-hashing",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
@@ -797,6 +755,26 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
@@ -907,12 +885,6 @@ version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.34"
|
||||
|
||||
@@ -47,6 +47,8 @@ static ALLOCATOR: LibcAlloc = LibcAlloc;
|
||||
fn main() {
|
||||
let metadata_bytes: &[u8] = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
|
||||
|
||||
let e = core::marker::PhantomData::<subxt_core::SubstrateConfig>;
|
||||
|
||||
// let genesis_hash = {
|
||||
// let h = "91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3";
|
||||
// let bytes = hex::decode(h).unwrap();
|
||||
|
||||
@@ -13,7 +13,7 @@ pub struct MinimalClient<C: Config> {
|
||||
pub genesis_hash: C::Hash,
|
||||
pub runtime_version: RuntimeVersion,
|
||||
pub metadata: Metadata,
|
||||
marker: std::marker::PhantomData<C>,
|
||||
marker: core::marker::PhantomData<C>,
|
||||
}
|
||||
|
||||
impl<C: Config> MinimalClient<C> {
|
||||
|
||||
@@ -11,6 +11,9 @@ use crate::client::MinimalClient;
|
||||
|
||||
use super::Config;
|
||||
use core::fmt::Debug;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
use derive_more::Display;
|
||||
|
||||
/// An error that can be emitted when trying to construct an instance of [`ExtrinsicParams`],
|
||||
@@ -34,17 +37,21 @@ pub enum ExtrinsicParamsError {
|
||||
UnknownSignedExtension(String),
|
||||
/// Some custom error.
|
||||
#[display(fmt = "Error constructing extrinsic parameters: {_0}")]
|
||||
#[cfg(feature = "std")]
|
||||
Custom(CustomExtrinsicParamsError),
|
||||
}
|
||||
|
||||
/// A custom error.
|
||||
#[cfg(feature = "std")]
|
||||
pub type CustomExtrinsicParamsError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||
|
||||
impl From<std::convert::Infallible> for ExtrinsicParamsError {
|
||||
fn from(value: std::convert::Infallible) -> Self {
|
||||
impl From<core::convert::Infallible> for ExtrinsicParamsError {
|
||||
fn from(value: core::convert::Infallible) -> Self {
|
||||
match value {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl From<CustomExtrinsicParamsError> for ExtrinsicParamsError {
|
||||
fn from(value: CustomExtrinsicParamsError) -> Self {
|
||||
ExtrinsicParamsError::Custom(value)
|
||||
|
||||
@@ -75,7 +75,7 @@ pub trait BlockHash:
|
||||
+ Encode
|
||||
+ PartialEq
|
||||
+ Eq
|
||||
+ std::hash::Hash
|
||||
+ core::hash::Hash
|
||||
{
|
||||
}
|
||||
impl<T> BlockHash for T where
|
||||
@@ -90,7 +90,7 @@ impl<T> BlockHash for T where
|
||||
+ Encode
|
||||
+ PartialEq
|
||||
+ Eq
|
||||
+ std::hash::Hash
|
||||
+ core::hash::Hash
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
use super::extrinsic_params::{ExtrinsicParams, ExtrinsicParamsEncoder, ExtrinsicParamsError};
|
||||
use super::Config;
|
||||
use crate::client::MinimalClient;
|
||||
use crate::prelude::*;
|
||||
use crate::utils::Era;
|
||||
use codec::{Compact, Encode};
|
||||
use collections::BTreeMap;
|
||||
use core::fmt::Debug;
|
||||
use derivative::Derivative;
|
||||
use scale_decode::DecodeAsType;
|
||||
use scale_info::PortableRegistry;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// A single [`SignedExtension`] has a unique name, but is otherwise the
|
||||
/// same as [`ExtrinsicParams`] in describing how to encode the extra and
|
||||
/// additional data.
|
||||
@@ -368,7 +368,7 @@ impl<T: Config> SignedExtension<T> for ChargeTransactionPayment {
|
||||
/// is a sensible default, and allows for a single configuration to work across multiple chains.
|
||||
pub struct AnyOf<T, Params> {
|
||||
params: Vec<Box<dyn ExtrinsicParamsEncoder>>,
|
||||
_marker: std::marker::PhantomData<(T, Params)>,
|
||||
_marker: core::marker::PhantomData<(T, Params)>,
|
||||
}
|
||||
|
||||
macro_rules! impl_tuples {
|
||||
@@ -393,7 +393,7 @@ macro_rules! impl_tuples {
|
||||
|
||||
// For each signed extension in the tuple, find the matching index in the metadata, if
|
||||
// there is one, and add it to a map with that index as the key.
|
||||
let mut exts_by_index = HashMap::new();
|
||||
let mut exts_by_index = BTreeMap::new();
|
||||
$({
|
||||
for (idx, e) in metadata.extrinsic().signed_extensions().iter().enumerate() {
|
||||
// Skip over any exts that have a match already:
|
||||
@@ -425,7 +425,7 @@ macro_rules! impl_tuples {
|
||||
|
||||
Ok(AnyOf {
|
||||
params,
|
||||
_marker: std::marker::PhantomData
|
||||
_marker: core::marker::PhantomData
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use super::{Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, Hashe
|
||||
use codec::{Decode, Encode};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::prelude::*;
|
||||
pub use crate::utils::{AccountId32, MultiAddress, MultiSignature};
|
||||
pub use primitive_types::{H256, U256};
|
||||
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
//!
|
||||
//! `#[no_std]` compatible core crate for subxt.
|
||||
|
||||
#![no_std]
|
||||
|
||||
pub mod client;
|
||||
pub mod config;
|
||||
pub mod dynamic;
|
||||
pub mod metadata;
|
||||
pub mod prelude;
|
||||
pub mod tx;
|
||||
pub mod utils;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use super::Metadata;
|
||||
use crate::prelude::*;
|
||||
|
||||
/// This trait is implemented for all types that also implement [`scale_decode::DecodeAsType`].
|
||||
pub trait DecodeWithMetadata: Sized {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::prelude::*;
|
||||
use derive_more::Display;
|
||||
use std::sync::Arc;
|
||||
use sync::Arc;
|
||||
|
||||
/// A cheaply clone-able representation of the runtime metadata received from a node.
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -11,7 +12,7 @@ pub struct Metadata {
|
||||
inner: Arc<subxt_metadata::Metadata>,
|
||||
}
|
||||
|
||||
impl std::ops::Deref for Metadata {
|
||||
impl core::ops::Deref for Metadata {
|
||||
type Target = subxt_metadata::Metadata;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#[cfg(not(feature = "std"))]
|
||||
extern crate alloc;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "std")] {
|
||||
|
||||
|
||||
|
||||
pub use std::{
|
||||
borrow,
|
||||
borrow::ToOwned,
|
||||
boxed::{Box},
|
||||
collections,
|
||||
format,
|
||||
format::format,
|
||||
string::{String},
|
||||
str,
|
||||
sync,
|
||||
vec,
|
||||
rc,
|
||||
};
|
||||
pub use std::vec::Vec;
|
||||
} else {
|
||||
pub use alloc::{
|
||||
borrow,
|
||||
borrow::ToOwned,
|
||||
boxed::{Box},
|
||||
collections,
|
||||
format,
|
||||
string::{String},
|
||||
str,
|
||||
sync,
|
||||
vec,
|
||||
rc,
|
||||
};
|
||||
pub use alloc::vec::Vec;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
// use codec::Encode;
|
||||
// use scale_encode::EncodeAsFields;
|
||||
// use scale_value::{Composite, ValueDef, Variant};
|
||||
// use std::{borrow::Cow, sync::Arc};
|
||||
// use core::{borrow::Cow, sync::Arc};
|
||||
|
||||
// /// This represents a transaction payload that can be submitted
|
||||
// /// to a node.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//! This doesn't contain much functionality itself, but is easy to convert to/from an `sp_core::AccountId32`
|
||||
//! for instance, to gain functionality without forcing a dependency on Substrate crates here.
|
||||
|
||||
use crate::prelude::*;
|
||||
use codec::{Decode, Encode};
|
||||
use derive_more::Display;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -146,13 +147,13 @@ impl<'de> Deserialize<'de> for AccountId32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for AccountId32 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl core::fmt::Display for AccountId32 {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
write!(f, "{}", self.to_ss58check())
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for AccountId32 {
|
||||
impl core::str::FromStr for AccountId32 {
|
||||
type Err = FromSs58Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
AccountId32::from_ss58check(s)
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
|
||||
//! Generic `scale_bits` over `bitvec`-like `BitOrder` and `BitFormat` types.
|
||||
|
||||
use crate::prelude::*;
|
||||
use codec::{Compact, Input};
|
||||
use core::marker::PhantomData;
|
||||
use scale_bits::{
|
||||
scale::format::{Format, OrderFormat, StoreFormat},
|
||||
Bits,
|
||||
};
|
||||
use scale_decode::IntoVisitor;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
/// Associates `bitvec::store::BitStore` trait with corresponding, type-erased `scale_bits::StoreFormat` enum.
|
||||
///
|
||||
@@ -144,7 +145,7 @@ impl<Store: BitStore, Order: BitOrder> codec::Encode for DecodedBits<Store, Orde
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub struct DecodedBitsVisitor<S, O>(std::marker::PhantomData<(S, O)>);
|
||||
pub struct DecodedBitsVisitor<S, O>(core::marker::PhantomData<(S, O)>);
|
||||
impl<Store, Order> scale_decode::Visitor for DecodedBitsVisitor<Store, Order> {
|
||||
type Value<'scale, 'info> = DecodedBits<Store, Order>;
|
||||
type Error = scale_decode::Error;
|
||||
|
||||
@@ -64,7 +64,9 @@ pub fn url_is_secure(url: &str) -> Result<bool, url::ParseError> {
|
||||
Ok(secure_scheme || is_localhost)
|
||||
}
|
||||
|
||||
/// A version of [`std::marker::PhantomData`] that is also Send and Sync (which is fine
|
||||
use crate::prelude::*;
|
||||
|
||||
/// A version of [`core::marker::PhantomData`] that is also Send and Sync (which is fine
|
||||
/// because regardless of the generic param, it is always possible to Send + Sync this
|
||||
/// 0 size type).
|
||||
#[derive(Derivative, Encode, Decode, scale_info::TypeInfo)]
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//! This doesn't contain much functionality itself, but is easy to convert to/from an `sp_runtime::MultiAddress`
|
||||
//! for instance, to gain functionality without forcing a dependency on Substrate crates here.
|
||||
|
||||
use crate::prelude::*;
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
/// A multi-format address wrapper for on-chain accounts. This is a simplified version of Substrate's
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::prelude::*;
|
||||
use codec::{Decode, Encode};
|
||||
use scale_decode::{visitor::DecodeAsTypeResult, IntoVisitor, Visitor};
|
||||
use scale_encode::EncodeAsType;
|
||||
@@ -29,7 +30,7 @@ impl<T: Encode> EncodeAsType for Static<T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct StaticDecodeAsTypeVisitor<T>(std::marker::PhantomData<T>);
|
||||
pub struct StaticDecodeAsTypeVisitor<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Decode> Visitor for StaticDecodeAsTypeVisitor<T> {
|
||||
type Value<'scale, 'info> = Static<T>;
|
||||
@@ -52,7 +53,7 @@ impl<T: Decode> Visitor for StaticDecodeAsTypeVisitor<T> {
|
||||
impl<T: Decode> IntoVisitor for Static<T> {
|
||||
type Visitor = StaticDecodeAsTypeVisitor<T>;
|
||||
fn into_visitor() -> Self::Visitor {
|
||||
StaticDecodeAsTypeVisitor(std::marker::PhantomData)
|
||||
StaticDecodeAsTypeVisitor(core::marker::PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,14 +65,14 @@ impl<T> From<T> for Static<T> {
|
||||
}
|
||||
|
||||
// Static<T> is just a marker type and should be as transparent as possible:
|
||||
impl<T> std::ops::Deref for Static<T> {
|
||||
impl<T> core::ops::Deref for Static<T> {
|
||||
type Target = T;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> std::ops::DerefMut for Static<T> {
|
||||
impl<T> core::ops::DerefMut for Static<T> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
//! runtime APIs. Deriving `EncodeAsType` would lead to the inner
|
||||
//! bytes to be re-encoded (length prefixed).
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::prelude::*;
|
||||
use codec::{Decode, Encode};
|
||||
use core::marker::PhantomData;
|
||||
use scale_decode::{visitor::DecodeAsTypeResult, DecodeAsType, IntoVisitor, Visitor};
|
||||
|
||||
use super::{Encoded, Static};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use super::PhantomDataSendSync;
|
||||
use crate::prelude::*;
|
||||
use codec::{Compact, Decode, DecodeAll, Encode};
|
||||
use derivative::Derivative;
|
||||
use scale_decode::{IntoVisitor, Visitor};
|
||||
@@ -108,7 +109,7 @@ impl<T> EncodeAsType for WrapperKeepOpaque<T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WrapperKeepOpaqueVisitor<T>(std::marker::PhantomData<T>);
|
||||
pub struct WrapperKeepOpaqueVisitor<T>(core::marker::PhantomData<T>);
|
||||
impl<T> Visitor for WrapperKeepOpaqueVisitor<T> {
|
||||
type Value<'scale, 'info> = WrapperKeepOpaque<T>;
|
||||
type Error = scale_decode::Error;
|
||||
@@ -153,7 +154,7 @@ impl<T> Visitor for WrapperKeepOpaqueVisitor<T> {
|
||||
impl<T> IntoVisitor for WrapperKeepOpaque<T> {
|
||||
type Visitor = WrapperKeepOpaqueVisitor<T>;
|
||||
fn into_visitor() -> Self::Visitor {
|
||||
WrapperKeepOpaqueVisitor(std::marker::PhantomData)
|
||||
WrapperKeepOpaqueVisitor(core::marker::PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +199,7 @@ mod test {
|
||||
+ Encode
|
||||
+ Decode
|
||||
+ PartialEq
|
||||
+ std::fmt::Debug
|
||||
+ core::fmt::Debug
|
||||
+ scale_info::TypeInfo
|
||||
+ 'static,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user