easy-ext
easy-ext copied to clipboard
A lightweight attribute macro for easily writing extension trait pattern.
# Context When I put `tracing::instrument` on the method in the extension trait I get a compile error ```rs use tracing::instrument; use easy_ext::ext; #[ext] impl String { #[instrument(skip_all)] fn foo(&self)...
Resolve issue #41 by introducing `#[ext_attr(trait_only)]` and `#[ext_attr(impl_only)]` attributes to specify trait-only and impl-only attributes respectively. ```rust #[ext(TraitOnlyExample)] #[ext_attr(trait_only)] #[my_trait_only_attr] impl String { fn foo(&self) {} } #[ext(ImplOnlyExample)] impl String...
For instance, the following toy example fails to compile, producing "error: expected `[`" ```rust use easy_ext::ext; #[ext] impl i32 { //! Square the number fn square(self) -> Self { self...