mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Derive no bound macros (to be also used in pallet macro) (#7280)
* derive no bound macros * explicit different variant for partialeq * fix ui for 1.47 * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * move test to frame-support-test * renames, code organization and remove expect as suggested * better doc * remove DebugStripped introduce RuntimeDebugNoBound * rename * fix test * fix ui test * fix line width * Update frame/support/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/support/procedural/src/clone_no_bound.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * fix confusing dead code Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
87c18598fc
commit
7ca9baf9b6
@@ -268,9 +268,82 @@ macro_rules! ord_parameter_types {
|
||||
|
||||
#[doc(inline)]
|
||||
pub use frame_support_procedural::{
|
||||
decl_storage, construct_runtime, transactional
|
||||
decl_storage, construct_runtime, transactional, RuntimeDebugNoBound
|
||||
};
|
||||
|
||||
/// Derive [`Clone`] but do not bound any generic.
|
||||
///
|
||||
/// This is useful for type generic over runtime:
|
||||
/// ```
|
||||
/// # use frame_support::CloneNoBound;
|
||||
/// trait Trait {
|
||||
/// type C: Clone;
|
||||
/// }
|
||||
///
|
||||
/// // Foo implements [`Clone`] because `C` bounds [`Clone`].
|
||||
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`Clone`].
|
||||
/// #[derive(CloneNoBound)]
|
||||
/// struct Foo<T: Trait> {
|
||||
/// c: T::C,
|
||||
/// }
|
||||
/// ```
|
||||
pub use frame_support_procedural::CloneNoBound;
|
||||
|
||||
/// Derive [`Eq`] but do not bound any generic.
|
||||
///
|
||||
/// This is useful for type generic over runtime:
|
||||
/// ```
|
||||
/// # use frame_support::{EqNoBound, PartialEqNoBound};
|
||||
/// trait Trait {
|
||||
/// type C: Eq;
|
||||
/// }
|
||||
///
|
||||
/// // Foo implements [`Eq`] because `C` bounds [`Eq`].
|
||||
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`Eq`].
|
||||
/// #[derive(PartialEqNoBound, EqNoBound)]
|
||||
/// struct Foo<T: Trait> {
|
||||
/// c: T::C,
|
||||
/// }
|
||||
/// ```
|
||||
pub use frame_support_procedural::EqNoBound;
|
||||
|
||||
/// Derive [`PartialEq`] but do not bound any generic.
|
||||
///
|
||||
/// This is useful for type generic over runtime:
|
||||
/// ```
|
||||
/// # use frame_support::PartialEqNoBound;
|
||||
/// trait Trait {
|
||||
/// type C: PartialEq;
|
||||
/// }
|
||||
///
|
||||
/// // Foo implements [`PartialEq`] because `C` bounds [`PartialEq`].
|
||||
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`PartialEq`].
|
||||
/// #[derive(PartialEqNoBound)]
|
||||
/// struct Foo<T: Trait> {
|
||||
/// c: T::C,
|
||||
/// }
|
||||
/// ```
|
||||
pub use frame_support_procedural::PartialEqNoBound;
|
||||
|
||||
/// Derive [`Debug`] but do not bound any generic.
|
||||
///
|
||||
/// This is useful for type generic over runtime:
|
||||
/// ```
|
||||
/// # use frame_support::DebugNoBound;
|
||||
/// # use core::fmt::Debug;
|
||||
/// trait Trait {
|
||||
/// type C: Debug;
|
||||
/// }
|
||||
///
|
||||
/// // Foo implements [`Debug`] because `C` bounds [`Debug`].
|
||||
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`Debug`].
|
||||
/// #[derive(DebugNoBound)]
|
||||
/// struct Foo<T: Trait> {
|
||||
/// c: T::C,
|
||||
/// }
|
||||
/// ```
|
||||
pub use frame_support_procedural::DebugNoBound;
|
||||
|
||||
/// Assert the annotated function is executed within a storage transaction.
|
||||
///
|
||||
/// The assertion is enabled for native execution and when `debug_assertions` are enabled.
|
||||
|
||||
Reference in New Issue
Block a user