pub struct ContextMatcher {
pub role: Option<FunctionRole>,
pub file_type: Option<FileType>,
pub is_async: Option<bool>,
pub framework_pattern: Option<FrameworkPattern>,
pub name_pattern: Option<String>,
}Expand description
Matcher for function context
Fields§
§role: Option<FunctionRole>Required function role (None = any)
file_type: Option<FileType>Required file type (None = any)
is_async: Option<bool>Required async status (None = any)
framework_pattern: Option<FrameworkPattern>Required framework pattern (None = any)
name_pattern: Option<String>Function name pattern (regex)
Implementations§
Source§impl ContextMatcher
impl ContextMatcher
Sourcepub fn for_role(role: FunctionRole) -> Self
pub fn for_role(role: FunctionRole) -> Self
Create a matcher for a specific role
Sourcepub fn for_file_type(file_type: FileType) -> Self
pub fn for_file_type(file_type: FileType) -> Self
Create a matcher for a specific file type
Sourcepub fn matches(&self, context: &FunctionContext) -> bool
pub fn matches(&self, context: &FunctionContext) -> bool
Check if this matcher matches the given context
Trait Implementations§
Source§impl Clone for ContextMatcher
impl Clone for ContextMatcher
Source§fn clone(&self) -> ContextMatcher
fn clone(&self) -> ContextMatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ContextMatcher
impl RefUnwindSafe for ContextMatcher
impl Send for ContextMatcher
impl Sync for ContextMatcher
impl Unpin for ContextMatcher
impl UnwindSafe for ContextMatcher
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more