pub struct BodyBus { /* private fields */ }Expand description
Named in-memory channels for sensors and actuators.
Channels hold the last known value in memory. Nothing here authorizes world writes or CAS mutations.
Implementations§
Source§impl BodyBus
impl BodyBus
pub fn new() -> Self
pub fn register( &mut self, name: &str, kind: ChannelKind, meta: Option<BTreeMap<String, Value>>, ) -> Result<BodyPacket, String>
pub fn unregister(&mut self, name: &str) -> bool
pub fn channel_meta(&self, name: &str) -> Option<&BTreeMap<String, Value>>
pub fn list_channels(&self) -> Vec<BodyChannelInfo>
Sourcepub fn read(&self, name: &str) -> BodyPacket
pub fn read(&self, name: &str) -> BodyPacket
Read last known value for a channel (observation only).
Sourcepub fn inject(
&mut self,
name: &str,
value: Value,
timestamp_ms: u64,
) -> BodyPacket
pub fn inject( &mut self, name: &str, value: Value, timestamp_ms: u64, ) -> BodyPacket
Simulate a sensor reading (in-memory only).
Allowed for Sensor and Bidirectional channels. Does not touch the world.
Sourcepub fn propose_command(
&mut self,
name: &str,
value: Value,
reason: &str,
timestamp_ms: u64,
) -> BodyPacket
pub fn propose_command( &mut self, name: &str, value: Value, reason: &str, timestamp_ms: u64, ) -> BodyPacket
Build an actuator command proposal without mutating the channel value.
Sourcepub fn apply_command(
&mut self,
name: &str,
value: Value,
timestamp_ms: u64,
) -> BodyPacket
pub fn apply_command( &mut self, name: &str, value: Value, timestamp_ms: u64, ) -> BodyPacket
Commit actuator value after a token-gated execute step.
Still never issues tokens or writes CAS; write_authorized stays false.
pub fn summary(&self) -> BodySummary
Trait Implementations§
Auto Trait Implementations§
impl Forget for BodyBus
impl Freeze for BodyBuswhere
*const LeafNode<String, ChannelState> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, ChannelState)>>: Freeze,
impl Move for BodyBus
impl RefUnwindSafe for BodyBus
impl Send for BodyBus
impl Sync for BodyBus
impl Unpin for BodyBus
impl UnsafeUnpin for BodyBuswhere
*const LeafNode<String, ChannelState> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, ChannelState)>>: UnsafeUnpin,
impl UnwindSafe for BodyBus
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