pub enum Strategy {
FirstMatch,
UniformRandom {
seed: Option<u64>,
},
WeightedRandom {
seed: Option<u64>,
},
Priority {
tiebreaker: PriorityTiebreaker,
},
RoundRobin,
}Expand description
Rule-evaluation strategy: decides which rule wins when multiple rules match the same request.
§RFC 007 — Strategy variants
The original FirstMatch strategy is unchanged and remains the
default. Three new strategies are added:
- [
UniformRandom] — pick uniformly at random from all matching rules. - [
WeightedRandom] — pick randomly, weighted by each rule’sweight. - [
Priority] — group by priority, apply a tiebreaker within the group.
Variants§
FirstMatch
Walk rules in order; return the first that matches. Default.
UniformRandom
Pick uniformly at random from all matching rules.
seed = Some(n) for reproducible test runs.
WeightedRandom
Pick randomly, weighted by each rule’s weight field (default 1).
Priority
Group matching rules by priority (higher wins). Within the
top-priority group, apply tiebreaker (default: first_match).
Fields
§
tiebreaker: PriorityTiebreakerRoundRobin
Cycle through matching rules in order, one per request.
State is kept in an Arc<AtomicUsize> on the parent RuleSet.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Strategy
impl<'de> Deserialize<'de> for Strategy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Strategy
impl RefUnwindSafe for Strategy
impl Send for Strategy
impl Sync for Strategy
impl Unpin for Strategy
impl UnsafeUnpin for Strategy
impl UnwindSafe for Strategy
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