mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 06:27:58 +00:00
Add (Partial)OrdNoBound derive macros (#2256)
This PR is related to [this](https://github.com/paritytech/polkadot-sdk/issues/154) issue. The idea is to add `OrdNoBound` and `PartialOrdNoBound` macros to the substrate `*NoBound` macros. closes #2198 ✄ ----------------------------------------------------------------------------- Thank you for your Pull Request! 🙏 Please make sure it follows the contribution guidelines outlined in [this document](https://github.com/paritytech/polkadot-sdk/blob/master/docs/CONTRIBUTING.md) and fill out the sections below. Once you're ready to submit your PR for review, please delete this section and leave only the text under the "Description" heading. # Description *Please include a summary of the changes and the related issue. Please also include relevant motivation and context, including:* - What does this PR do? - Why are these changes needed? - How were these changes implemented and what do they affect? *Use [Github semantic linking](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) to address any open issues this PR relates to or closes.* Fixes # (issue number, *if applicable*) Closes # (issue number, *if applicable*) # Checklist - [ ] My PR includes a detailed description as outlined in the "Description" section above - [ ] My PR follows the [labeling requirements](CONTRIBUTING.md#Process) of this project (at minimum one label for `T` required) - [ ] I have made corresponding changes to the documentation (if applicable) - [ ] I have added tests that prove my fix is effective or that my feature works (if applicable) You can remove the "Checklist" section once all have been checked. Thank you for your contribution! ✄ ----------------------------------------------------------------------------- --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <>
This commit is contained in:
@@ -557,6 +557,42 @@ pub use frame_support_procedural::EqNoBound;
|
||||
/// ```
|
||||
pub use frame_support_procedural::PartialEqNoBound;
|
||||
|
||||
/// Derive [`Ord`] but do not bound any generic.
|
||||
///
|
||||
/// This is useful for type generic over runtime:
|
||||
/// ```
|
||||
/// # use frame_support::{OrdNoBound, PartialOrdNoBound, EqNoBound, PartialEqNoBound};
|
||||
/// trait Config {
|
||||
/// type C: Ord;
|
||||
/// }
|
||||
///
|
||||
/// // Foo implements [`Ord`] because `C` bounds [`Ord`].
|
||||
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`Ord`].
|
||||
/// #[derive(EqNoBound, OrdNoBound, PartialEqNoBound, PartialOrdNoBound)]
|
||||
/// struct Foo<T: Config> {
|
||||
/// c: T::C,
|
||||
/// }
|
||||
/// ```
|
||||
pub use frame_support_procedural::OrdNoBound;
|
||||
|
||||
/// Derive [`PartialOrd`] but do not bound any generic.
|
||||
///
|
||||
/// This is useful for type generic over runtime:
|
||||
/// ```
|
||||
/// # use frame_support::{OrdNoBound, PartialOrdNoBound, EqNoBound, PartialEqNoBound};
|
||||
/// trait Config {
|
||||
/// type C: PartialOrd;
|
||||
/// }
|
||||
///
|
||||
/// // Foo implements [`PartialOrd`] because `C` bounds [`PartialOrd`].
|
||||
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`PartialOrd`].
|
||||
/// #[derive(PartialOrdNoBound, PartialEqNoBound, EqNoBound)]
|
||||
/// struct Foo<T: Config> {
|
||||
/// c: T::C,
|
||||
/// }
|
||||
/// ```
|
||||
pub use frame_support_procedural::PartialOrdNoBound;
|
||||
|
||||
/// Derive [`Debug`] but do not bound any generic.
|
||||
///
|
||||
/// This is useful for type generic over runtime:
|
||||
|
||||
Reference in New Issue
Block a user