Appendix D: Troubleshooting
Common Issues
“cannot find macro aspect in this scope”
Add aspect-macros to dependencies:
[dependencies]
aspect-macros = "0.1"
“no method named before found”
Implement the Aspect trait:
#![allow(unused)]
fn main() {
impl Aspect for YourAspect {
fn before(&self, ctx: &JoinPoint) {
// Your code
}
}
}
Aspect not being called
- Verify
#[aspect(...)]attribute is present - Check aspect implements
Aspecttrait - Ensure function is actually being called
Performance issues
- Profile with
cargo bench - Check for expensive operations in aspects
- Consider caching in aspects
- Use
#[inline]for hot paths
See Getting Started for installation issues.