pub struct ComposableDecider { /* private fields */ }Expand description
ComposableDecider: Combines a base decider with modifiers
This enables layered decision-making:
- Base decider handles target selection (WHERE to act)
- Modifiers adjust behavior based on conditions (HOW to act)
§Example
ⓘ
let decider = ComposableDecider::new(MurmurationDecider::default())
.with_modifier(ErrorAwareModifier::new(0.7))
.with_modifier(StallDetectionModifier::new(5));Implementations§
Source§impl ComposableDecider
impl ComposableDecider
Sourcepub fn new(base: impl Decider + 'static) -> Self
pub fn new(base: impl Decider + 'static) -> Self
Create a new composable decider with the given base
Sourcepub fn with_modifier(self, modifier: impl DecisionModifier + 'static) -> Self
pub fn with_modifier(self, modifier: impl DecisionModifier + 'static) -> Self
Add a modifier to the chain
Sourcepub fn error_aware(self, weight: f64) -> Self
pub fn error_aware(self, weight: f64) -> Self
Add an error-aware modifier
Sourcepub fn stall_detection(self, threshold: u64) -> Self
pub fn stall_detection(self, threshold: u64) -> Self
Add a stall detection modifier
Sourcepub fn success_rate(self, threshold: f64) -> Self
pub fn success_rate(self, threshold: f64) -> Self
Add a success rate modifier
Sourcepub fn with_retry(self, max_retries: u32) -> Self
pub fn with_retry(self, max_retries: u32) -> Self
Add a retry modifier
Trait Implementations§
Source§impl Debug for ComposableDecider
impl Debug for ComposableDecider
Source§impl Decider for ComposableDecider
impl Decider for ComposableDecider
Source§fn decide(&self, context: &DecisionContext, state: &AgentState) -> Action
fn decide(&self, context: &DecisionContext, state: &AgentState) -> Action
Decide the next action based on context and state
Auto Trait Implementations§
impl Freeze for ComposableDecider
impl !RefUnwindSafe for ComposableDecider
impl Send for ComposableDecider
impl Sync for ComposableDecider
impl Unpin for ComposableDecider
impl UnsafeUnpin for ComposableDecider
impl !UnwindSafe for ComposableDecider
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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