Expand description
WeightSource trait for computing attack weights from external
state (relationship metadata, personality traits, etc.).
This is a deliberately minimal abstraction for v0.1.0 — it exists
so consumers like the future encounter crate can pass a policy
closure for deriving weights, without coupling this crate to any
specific narrative-stack types. The full encounter-specific
integration lives in whatever bridge crate the narrative team
ships; this trait is just the hook.
Structs§
- Closure
Weight Source - A closure-based
WeightSourcethat wraps anyFn(&A, &A) -> Option<f64>.
Traits§
- Weight
Source - A source of attack weights. Given an attacker and a target (and
whatever context
Selfcarries), produce the weight for the corresponding attack edge.
Functions§
- populate_
from_ source - Populate a
WeightedFrameworkfrom a list of attack pairs, pulling each weight from the providedWeightSource. Pairs for which the source returnsNoneare skipped. Pairs for which the source returns an invalid weight propagate anError::InvalidWeight.