pub struct AnalysisBus<T: 'static> { /* private fields */ }Expand description
A broadcast hub: one publisher in, every subscriber out.
It holds no items. write calls each subscriber and returns; if nobody
is subscribed the datum is gone (D90). A component that needs to keep the
traffic subscribes and keeps it — in a Vec, or in an unbounded TlmFifo
it owns, if it wants to pull on its own schedule.
Declare it as a child with #[component], like a TlmFifo, then hand
out its exports in connect: pub_export for the
source, sub_export for each listener.
Implementations§
Source§impl<T: 'static> AnalysisBus<T>
impl<T: 'static> AnalysisBus<T>
pub fn new() -> AnalysisBus<T>
Sourcepub fn pub_export(&self) -> PublishExport<T>
pub fn pub_export(&self) -> PublishExport<T>
The publish side, for a source’s PublishPort.
Sourcepub fn sub_export(&self) -> SubscribeExport<T>
pub fn sub_export(&self) -> SubscribeExport<T>
The subscribe side, for a subscriber’s SubscribePort. Connect
several; each one sees every item.
Sourcepub fn write(&self, item: &T)
pub fn write(&self, item: &T)
Broadcast an item, as the owner of the hub rather than through a port.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
How many subscribers are listening. Zero is legal.
Trait Implementations§
Source§impl<T: 'static> Clone for AnalysisBus<T>
impl<T: 'static> Clone for AnalysisBus<T>
Source§impl<T: 'static> Component for AnalysisBus<T>
impl<T: 'static> Component for AnalysisBus<T>
Source§fn build(&mut self, ctx: &mut RustdvCtx)
fn build(&mut self, ctx: &mut RustdvCtx)
build — top-down. Where a component constructs its children
(D6); the gap between “a component exists” and “its children exist”
that all late binding lives in. Read moreSource§fn connect(&mut self, ctx: &mut RustdvCtx)
fn connect(&mut self, ctx: &mut RustdvCtx)
connect — bottom-up. Wire children together once they exist. Read moreSource§fn end_of_elaboration(&mut self, ctx: &mut RustdvCtx)
fn end_of_elaboration(&mut self, ctx: &mut RustdvCtx)
end_of_elaboration — top-down. The hierarchy is final. Read moreSource§fn start_of_simulation(&mut self, ctx: &mut RustdvCtx)
fn start_of_simulation(&mut self, ctx: &mut RustdvCtx)
start_of_simulation — top-down. Last chance before time moves. Read moreSource§fn check(&mut self, ctx: &mut RustdvCtx, errors: &mut CheckSink)
fn check(&mut self, ctx: &mut RustdvCtx, errors: &mut CheckSink)
check — top-down. Report failures into the sink. Read moreSource§fn final_phase(&mut self, ctx: &mut RustdvCtx)
fn final_phase(&mut self, ctx: &mut RustdvCtx)
Source§fn start(&mut self, ctx: &mut RustdvCtx)
fn start(&mut self, ctx: &mut RustdvCtx)
Transitional spawn hook, pre-dating the restored
run
traversal. tinyalu_tb and the not-yet-converted chapters still
spawn free-running behavior here; it folds into run as each
converts. Not part of the nine-phase lifecycle.Source§fn comp_name() -> &'static strwhere
Self: Sized,
fn comp_name() -> &'static strwhere
Self: Sized,
This type’s registered short name, used as the factory override key.
The last path segment of the type name (
Foo from
crate::mod::Foo), which matches the name #[derive(Component)]
registers.Source§fn new_comp() -> RustdvComp
fn new_comp() -> RustdvComp
Build this component the normal way and drop it in an
crate::factory::RustdvComp
slot — the analogue of UVM’s new (D75). Not overridable.Source§fn create_comp() -> RustdvComp
fn create_comp() -> RustdvComp
Build this component through the factory — the analogue of UVM’s
create (D75). The default is built now and the slot is flagged; the
build walk swaps in an override if one applies.Source§impl<T: 'static> ComponentNode for AnalysisBus<T>
impl<T: 'static> ComponentNode for AnalysisBus<T>
Source§fn node_name(&self) -> &'static str
fn node_name(&self) -> &'static str
The component’s type-level name (hierarchical path is synthesized
from field names during traversal).
Source§fn children_mut(&mut self) -> Vec<(String, &mut (dyn ComponentNode + 'static))>
fn children_mut(&mut self) -> Vec<(String, &mut (dyn ComponentNode + 'static))>
Direct children as (field-derived name, node) pairs, in declaration
order. An owned Vec, not a
visit_children-style sync callback:
run_all awaits inside the walk, and a higher-ranked closure
cannot yield a child borrow that outlives the call, so the borrows
have to come back in a value the caller holds. An Option<T> child
created during build (D6) appears here only once it is Some.Source§fn port_slot(&self, name: &str) -> Option<Rc<dyn Any>>
fn port_slot(&self, name: &str) -> Option<Rc<dyn Any>>
This node’s port binding cell of the given name, erased (D83). Read more
Source§fn port_infos(&self) -> Vec<PortInfo>
fn port_infos(&self) -> Vec<PortInfo>
Every port this node declares, for the elaboration report.
Source§fn resolve_children(&mut self, ctx: &RustdvCtx)
fn resolve_children(&mut self, ctx: &RustdvCtx)
Resolve factory overrides for this node’s
RustdvComp fields (D75).
The derive generates this to call field.resolve(ctx, "field") for
each RustdvComp field; the default is a no-op for nodes with none.
Called by build_all after build, before descending — so a
swapped-out default’s own phases never run.Source§fn take_children(&mut self) -> Vec<(String, Box<dyn ComponentNode>)>
fn take_children(&mut self) -> Vec<(String, Box<dyn ComponentNode>)>
Move this node’s
RustdvComp children out, for the run phase (D82b). Read moreSource§fn restore_children(&mut self, taken: Vec<(String, Box<dyn ComponentNode>)>)
fn restore_children(&mut self, taken: Vec<(String, Box<dyn ComponentNode>)>)
Put back what
ComponentNode::take_children removed, in the same order.
Called unconditionally after the run phase — including on error — so the
post-run phases walk a whole tree.Auto Trait Implementations§
impl<T> !RefUnwindSafe for AnalysisBus<T>
impl<T> !Send for AnalysisBus<T>
impl<T> !Sync for AnalysisBus<T>
impl<T> !UnwindSafe for AnalysisBus<T>
impl<T> Freeze for AnalysisBus<T>
impl<T> Unpin for AnalysisBus<T>
impl<T> UnsafeUnpin for AnalysisBus<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynPhases for Twhere
T: Component,
impl<T> DynPhases for Twhere
T: Component,
fn dyn_build(&mut self, ctx: &mut RustdvCtx)
Source§fn dyn_run<'a>(
&'a mut self,
ctx: &'a mut RustdvCtx,
) -> Pin<Box<dyn Future<Output = Result<(), TestError>> + 'a>>
fn dyn_run<'a>( &'a mut self, ctx: &'a mut RustdvCtx, ) -> Pin<Box<dyn Future<Output = Result<(), TestError>> + 'a>>
The async
run, boxed so it can be awaited behind dyn (D48). This
is the object-safe shim run_all needs to fire each component’s run.