Skip to main content

Module shared

Module shared 

Source
Expand description

RustdvShared<T>: state two components can both see (D88).

Analysis delivery has to be synchronous — the publisher calls write and every subscriber’s handler runs before control comes back, with no await and no simulation time passing. But a subscriber’s handler needs &mut subscriber while the publisher’s run holds &mut publisher, and siblings in the tree cannot reach each other.

The way out is to share the state, not the component. A subscriber keeps its tally in a RustdvShared<T>, hands a second handle to its port, and both see the same data. Delivery then mutates the tally without ever touching the component.

The name is deliberate. This is not a general Rust facility — someone who goes looking for Shared<T> in the standard library will not find it — so it wears the framework’s name and says where it comes from.

Structs§

RustdvShared
A handle to state shared between a component and its analysis port.