impl_scope!() { /* proc-macro */ }Expand description
Scope supporting impl Self and advanced attribute macros
This macro facilitates definition of a type (struct, enum or union) plus
implementations via impl Self { .. } syntax: Self is expanded to the
type’s name, including generics and bounds (as defined on the type).
Caveat: rustfmt can not yet format contents (see
rustfmt#5254,
rustfmt#5538).
Note: prefer impl_self over this macro unless using
impl_default. This macro will be removed once
RFC 3681 (default field
values) is stable in this crate’s MSRV.
See impl_tools::impl_scope
for full documentation.
§Special attribute macros
Additionally, impl_scope! supports special attribute macros evaluated
within its scope:
#[impl_default]: implement [Default] using field initializers (which are not legal syntax outside ofimpl_scope!)#[widget]: implementkas::Widgettrait family
Note: matching these macros within impl_scope! does not use path
resolution. Using #[kas_macros::impl_default] would resolve the variant
of this macro which doesn’t support field initializers.