Expand description
Combinators that build one pipeline component out of several.
ComposedVehiclejoins an independentStateSourceandActuatorinto aVehicle, e.g. an IMU/estimator and an ESC driver on hardware. The two halves don’t see each other, so it doesn’t fit a state source that needs the actuator’s data (such as a simulator bridge’s truth state); that case needs a different combinator.(A, B)is aTelemetryPublisherthat fans each record out to both sinks; nest tuples for more.()is the no-op sink.
Both are allocation-free and add no dynamic dispatch.
use stable_flight::{TelemetryPublisher, TelemetryRecord};
#[derive(Default)]
struct Counter(u32);
impl TelemetryPublisher for Counter {
fn publish(&mut self, _record: &TelemetryRecord) {
self.0 += 1;
}
}
// A ground-station sink, a log sink, and `()` where a slot needs no sink.
let mut sinks = (Counter::default(), (Counter::default(), ()));
sinks.publish(&record);
assert_eq!((sinks.0.0, sinks.1.0.0), (1, 1));Structs§
- Composed
Vehicle - A
Vehiclemade of a separate state source and actuator.