Crates.io | aspect |
lib.rs | aspect |
version | 0.3.0 |
source | src |
created_at | 2019-02-06 23:15:39.719668 |
updated_at | 2021-03-26 16:17:13.448509 |
description | An Aspect Toolkit for Rust |
homepage | |
repository | https://github.com/magnet/aspect-rs |
max_upload_size | |
id | 113233 |
size | 7,188 |
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.
Updated dependencies to use syn
, proc-macro2
and quote
1.0
Aspect-RS runs on Rust
stable.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.