mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
update DefaultNoBound derive macro (#12723)
fix derive for empty enums Update derive & ui tests clean up Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> rename variable formatting & clippy formatting Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -621,14 +621,23 @@ pub use frame_support_procedural::DebugNoBound;
|
||||
/// # use frame_support::DefaultNoBound;
|
||||
/// # use core::default::Default;
|
||||
/// trait Config {
|
||||
/// type C: Default;
|
||||
/// type C: Default;
|
||||
/// }
|
||||
///
|
||||
/// // Foo implements [`Default`] because `C` bounds [`Default`].
|
||||
/// // Otherwise compilation will fail with an output telling `c` doesn't implement [`Default`].
|
||||
/// #[derive(DefaultNoBound)]
|
||||
/// struct Foo<T: Config> {
|
||||
/// c: T::C,
|
||||
/// c: T::C,
|
||||
/// }
|
||||
///
|
||||
/// // Also works with enums, by specifying the default with #[default]:
|
||||
/// #[derive(DefaultNoBound)]
|
||||
/// enum Bar<T: Config> {
|
||||
/// // Bar will implement Default as long as all of the types within Baz also implement default.
|
||||
/// #[default]
|
||||
/// Baz(T::C),
|
||||
/// Quxx,
|
||||
/// }
|
||||
/// ```
|
||||
pub use frame_support_procedural::DefaultNoBound;
|
||||
|
||||
Reference in New Issue
Block a user