pub trait ContextEnricher:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn enrich(&self, fib_entry: Option<&FibEntry>, extensions: &mut AnyMap);
}Expand description
Populates cross-layer data in the strategy context extensions.
Implementations pull from whatever data source they own (RadioTable,
FlowTable, GPS receiver, battery monitor, …) and insert a DTO into
the AnyMap. StrategyStage holds a Vec<Arc<dyn ContextEnricher>>
and calls each one before every strategy invocation.
§Adding a new data source
- Define a DTO struct (e.g.
LocationSnapshot) inndn-strategy::cross_layer. - Implement
ContextEnricher— read your data source, build the DTO, callextensions.insert(dto). - Register via
EngineBuilder::context_enricher(Arc::new(YourEnricher { ... })).
No changes to StrategyContext, StrategyStage, or existing enrichers are needed.