pub struct CompiledPriority {
pub matcher: Pattern,
pub weight: f32,
pub original_pattern: String,
}
Expand description
Compiled priority rule for efficient pattern matching
This struct represents a custom priority rule that has been compiled from the configuration file. The glob pattern is pre-compiled for performance, and the weight is applied additively to the base file type priority.
§Priority Calculation
Final priority = base_priority + weight (if pattern matches)
§Pattern Matching
Uses first-match-wins semantics - the first pattern that matches a file will determine the priority adjustment. Subsequent patterns are not evaluated.
Fields§
§matcher: Pattern
Pre-compiled glob pattern for efficient matching
weight: f32
Priority weight to add to base priority (can be negative)
original_pattern: String
Original pattern string for debugging and error reporting
Implementations§
Source§impl CompiledPriority
impl CompiledPriority
Sourcepub fn new(pattern: &str, weight: f32) -> Result<Self, PatternError>
pub fn new(pattern: &str, weight: f32) -> Result<Self, PatternError>
Create a CompiledPriority from a pattern string
Sourcepub fn try_from_config_priority(
priority: &Priority,
) -> Result<Self, PatternError>
pub fn try_from_config_priority( priority: &Priority, ) -> Result<Self, PatternError>
Convert from config::Priority to CompiledPriority with error handling
Trait Implementations§
Source§impl Clone for CompiledPriority
impl Clone for CompiledPriority
Source§fn clone(&self) -> CompiledPriority
fn clone(&self) -> CompiledPriority
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for CompiledPriority
impl RefUnwindSafe for CompiledPriority
impl Send for CompiledPriority
impl Sync for CompiledPriority
impl Unpin for CompiledPriority
impl UnwindSafe for CompiledPriority
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
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>
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>
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