Skip to main content

WeightSource

Trait WeightSource 

Source
pub trait WeightSource<A> {
    // Required method
    fn weight_for(&self, attacker: &A, target: &A) -> Option<f64>;
}
Expand description

A source of attack weights. Given an attacker and a target (and whatever context Self carries), produce the weight for the corresponding attack edge.

Implementations might read participant relationship metadata, personality compatibility, recent interaction history, or any other external state. The trait itself is stateless from this crate’s perspective.

Required Methods§

Source

fn weight_for(&self, attacker: &A, target: &A) -> Option<f64>

Compute the weight for an attack from attacker to target. Returns None if this source has no opinion (i.e., the attack should not be added). Returns Some(w) otherwise.

Implementors§

Source§

impl<A, F> WeightSource<A> for ClosureWeightSource<F>
where F: Fn(&A, &A) -> Option<f64>,