Crate aspect[−][src]
An Aspect Toolkit for Rust
Aspect-RS is a project aiming to provide common ground for the main Aspect-Oriented use cases in Rust. By leveraging the trait system, declarative and procedural macros, Aspect-RS provides blocks that let you wrap methods with your custom logic.
The project has been extracted from the Metered project, which uses the technique to build metrics that can work on expressions or methods, whether they’re async
or not. The technique seemed general enough to be in its own crate and see if it is of any interest to other parties.
Aspect-RS provides “pointcut” traits when entering or exiting an expression (OnEnter
and OnResult
), experimental Update
and UpdateRef
traits that can use parameter shadowing to intercept and update method parameters, and weaving constructs useful when building procedural macros. Please look at the Metered project to see Aspect-RS in action.
Modules
update | An experimental module providing a way to update method parameters in aspects. |
Enums
Advice | An |
Traits
Enter | The |
OnResult | The |
OnResultMut | The |
Weave | A trait to “Weave” an |