pub enum Pointcut {
Execution(ExecutionPattern),
Within(ModulePattern),
And(Box<Pointcut>, Box<Pointcut>),
Or(Box<Pointcut>, Box<Pointcut>),
Not(Box<Pointcut>),
}Expand description
A pointcut expression that matches joinpoints (functions).
Variants§
Execution(ExecutionPattern)
Match function execution: execution(pub fn save(..))
Within(ModulePattern)
Match functions within a module: within(crate::api)
And(Box<Pointcut>, Box<Pointcut>)
Logical AND: both pointcuts must match
Or(Box<Pointcut>, Box<Pointcut>)
Logical OR: either pointcut must match
Not(Box<Pointcut>)
Logical NOT: pointcut must not match
Implementations§
Source§impl Pointcut
impl Pointcut
Sourcepub fn parse(input: &str) -> Result<Self, String>
pub fn parse(input: &str) -> Result<Self, String>
Parse a pointcut expression from a string.
§Examples
use aspect_core::pointcut::Pointcut;
let pc = Pointcut::parse("execution(pub fn *(..))").unwrap();
let pc = Pointcut::parse("within(crate::api)").unwrap();
let pc = Pointcut::parse("execution(pub fn *(..)) && within(crate::api)").unwrap();Sourcepub fn public_functions() -> Self
pub fn public_functions() -> Self
Convenience method to create an execution pointcut for all public functions.
Equivalent to Pointcut::parse("execution(pub fn *(..))").
§Example
use aspect_core::pointcut::Pointcut;
let pc = Pointcut::public_functions();Sourcepub fn all_functions() -> Self
pub fn all_functions() -> Self
Convenience method to create an execution pointcut for all functions.
Equivalent to Pointcut::parse("execution(fn *(..))").
§Example
use aspect_core::pointcut::Pointcut;
let pc = Pointcut::all_functions();Sourcepub fn within_module(module_path: impl Into<String>) -> Self
pub fn within_module(module_path: impl Into<String>) -> Self
Convenience method to create a within pointcut for a module.
§Example
use aspect_core::pointcut::Pointcut;
let pc = Pointcut::within_module("crate::api");Trait Implementations§
Source§impl Matcher for Pointcut
impl Matcher for Pointcut
Source§fn matches(&self, function: &FunctionInfo) -> bool
fn matches(&self, function: &FunctionInfo) -> bool
Check if this pointcut matches the given function.
impl StructuralPartialEq for Pointcut
Auto Trait Implementations§
impl Freeze for Pointcut
impl RefUnwindSafe for Pointcut
impl Send for Pointcut
impl Sync for Pointcut
impl Unpin for Pointcut
impl UnsafeUnpin for Pointcut
impl UnwindSafe for Pointcut
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more