mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-03 20:27:22 +00:00
Runtime logging. (#3821)
* Implement Printable for tuples. * Add debugging function. * Add debug 1. * Implement for everything. * RuntimeDebug derive. * Introduce RuntimeDebug. * Add some dummy logging. * Replace RuntimeDebug with Debug. * Revert "Replace RuntimeDebug with Debug." This reverts commit bc47070a8cb30241b2b590b2fa29fd195088162f. * Working on Debug for all. * Fix bounds. * Add debug utils. * Implement runtime logging. * Add some docs and clean up. * Clean up derives. * Fix custom derive impl. * Bump runtime. * Fix long lines. * Fix doc test. * Use CARGO_CFG_STD. * Revert "Use CARGO_CFG_STD." This reverts commit ea429566de18ed0fa052571b359eb9826a64a9f4. * Use parse_macro_input * Update lockfile. * Apply review suggestions. * Remove stray re-export. * Add no-std impl. * Update lockfile.
This commit is contained in:
committed by
Bastian Köcher
parent
934d7aac1c
commit
20a3989785
@@ -17,9 +17,7 @@
|
||||
//! Dispatch system. Contains a macro for defining runtime modules and
|
||||
//! generating values representing lazy module function calls.
|
||||
|
||||
pub use crate::rstd::{result, prelude::{Vec, Clone, Eq, PartialEq}, marker};
|
||||
#[cfg(feature = "std")]
|
||||
pub use std::fmt;
|
||||
pub use crate::rstd::{result, fmt, prelude::{Vec, Clone, Eq, PartialEq}, marker};
|
||||
pub use crate::codec::{Codec, EncodeLike, Decode, Encode, Input, Output, HasCompact, EncodeAsRef};
|
||||
pub use srml_metadata::{
|
||||
FunctionMetadata, DecodeDifferent, DecodeDifferentArray, FunctionArgumentMetadata,
|
||||
@@ -29,7 +27,9 @@ pub use sr_primitives::{
|
||||
weights::{
|
||||
SimpleDispatchInfo, GetDispatchInfo, DispatchInfo, WeighData, ClassifyDispatch,
|
||||
TransactionPriority
|
||||
}, traits::{Dispatchable, DispatchResult, ModuleDispatchError}, DispatchError
|
||||
},
|
||||
traits::{Dispatchable, DispatchResult, ModuleDispatchError},
|
||||
DispatchError,
|
||||
};
|
||||
|
||||
/// A type that cannot be instantiated.
|
||||
@@ -48,18 +48,9 @@ pub trait Callable<T> {
|
||||
// https://github.com/rust-lang/rust/issues/51331
|
||||
pub type CallableCallFor<A, T> = <A as Callable<T>>::Call;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub trait Parameter: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub trait Parameter: Codec + EncodeLike + Clone + Eq {}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq {}
|
||||
|
||||
/// Declares a `Module` struct and a `Call` enum, which implements the dispatch logic.
|
||||
///
|
||||
/// ## Declaration
|
||||
@@ -1071,8 +1062,7 @@ macro_rules! decl_module {
|
||||
$crate::__check_reserved_fn_name! { $( $fn_name )* }
|
||||
|
||||
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "std", derive(Debug))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, $crate::RuntimeDebug)]
|
||||
pub struct $mod_type<
|
||||
$trait_instance: $trait_name
|
||||
$(<I>, $instance: $instantiable $( = $module_default_instance)?)?
|
||||
@@ -1223,7 +1213,6 @@ macro_rules! decl_module {
|
||||
for $call_type<$trait_instance $(, $instance)?> where $( $other_where_bounds )*
|
||||
{}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?> $crate::dispatch::fmt::Debug
|
||||
for $call_type<$trait_instance $(, $instance)?> where $( $other_where_bounds )*
|
||||
{
|
||||
@@ -1325,8 +1314,12 @@ macro_rules! impl_outer_dispatch {
|
||||
}
|
||||
) => {
|
||||
$(#[$attr])*
|
||||
#[derive(Clone, PartialEq, Eq, $crate::codec::Encode, $crate::codec::Decode)]
|
||||
#[cfg_attr(feature = "std", derive(Debug))]
|
||||
#[derive(
|
||||
Clone, PartialEq, Eq,
|
||||
$crate::codec::Encode,
|
||||
$crate::codec::Decode,
|
||||
$crate::RuntimeDebug,
|
||||
)]
|
||||
pub enum $call_type {
|
||||
$(
|
||||
$camelcase ( $crate::dispatch::CallableCallFor<$camelcase, $runtime> )
|
||||
|
||||
Reference in New Issue
Block a user