Merge branch 'tadeohepperle/subxt-metadata-no-std' into tadeohepperle/subxt-core-2

This commit is contained in:
Tadeo hepperle
2024-02-14 16:03:17 +01:00
21 changed files with 374 additions and 106 deletions
+14 -1
View File
@@ -30,7 +30,13 @@ pub trait ConstantAddress {
/// This represents the address of a constant.
#[derive(Derivative)]
#[derivative(Clone(bound = ""), Debug(bound = ""))]
#[derivative(
Clone(bound = ""),
Debug(bound = ""),
Eq(bound = ""),
Ord(bound = ""),
PartialEq(bound = "")
)]
pub struct Address<ReturnTy> {
pallet_name: Cow<'static, str>,
constant_name: Cow<'static, str>,
@@ -38,6 +44,13 @@ pub struct Address<ReturnTy> {
_marker: core::marker::PhantomData<ReturnTy>,
}
// Manual implementation to work around https://github.com/mcarton/rust-derivative/issues/115.
impl<ReturnTy> PartialOrd for Address<ReturnTy> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
/// The type of address typically used to return dynamic constant values.
pub type DynamicAddress = Address<DecodedValueThunk>;
+5 -1
View File
@@ -74,7 +74,11 @@ pub trait RuntimeApiPayload {
#[derive(Derivative)]
#[derivative(
Clone(bound = "ArgsData: Clone"),
Debug(bound = "ArgsData: core::fmt::Debug")
Debug(bound = "ArgsData: std::fmt::Debug"),
Eq(bound = "ArgsData: std::cmp::Eq"),
Ord(bound = "ArgsData: std::cmp::Ord"),
PartialEq(bound = "ArgsData: std::cmp::PartialEq"),
PartialOrd(bound = "ArgsData: std::cmp::PartialOrd")
)]
pub struct Payload<ArgsData, ReturnTy> {
trait_name: Cow<'static, str>,
+5 -1
View File
@@ -58,7 +58,11 @@ pub trait StorageAddress {
#[derive(Derivative)]
#[derivative(
Clone(bound = "StorageKey: Clone"),
Debug(bound = "StorageKey: core::fmt::Debug")
Debug(bound = "StorageKey: std::fmt::Debug"),
Eq(bound = "StorageKey: std::cmp::Eq"),
Ord(bound = "StorageKey: std::cmp::Ord"),
PartialEq(bound = "StorageKey: std::cmp::PartialEq"),
PartialOrd(bound = "StorageKey: std::cmp::PartialOrd")
)]
pub struct Address<StorageKey, ReturnTy, Fetchable, Defaultable, Iterable> {
pallet_name: Cow<'static, str>,
+10 -1
View File
@@ -14,6 +14,7 @@ use alloc::string::String;
use alloc::sync::Arc;
use alloc::vec::Vec;
use codec::Encode;
use derivative::Derivative;
use scale_encode::EncodeAsFields;
use scale_value::{Composite, ValueDef, Variant};
@@ -50,7 +51,15 @@ pub struct ValidationDetails<'a> {
}
/// A transaction payload containing some generic `CallData`.
#[derive(Clone, Debug)]
#[derive(Derivative)]
#[derivative(
Clone(bound = "CallData: Clone"),
Debug(bound = "CallData: std::fmt::Debug"),
Eq(bound = "CallData: std::cmp::Eq"),
Ord(bound = "CallData: std::cmp::Ord"),
PartialEq(bound = "CallData: std::cmp::PartialEq"),
PartialOrd(bound = "CallData: std::cmp::PartialOrd")
)]
pub struct Payload<CallData> {
pallet_name: Cow<'static, str>,
call_name: Cow<'static, str>,