pub struct ProducerCtx<'a> { /* private fields */ }Expand description
Context handed to a producer’s build closure on activation.
Provides:
Self::node_id/Self::core— identity + Core access for sink callbacks that re-enter Core.Self::subscribe_to— subscribe to an upstream Core node; the resultingSubscriptionis auto-tracked undernode_idin the binding’s producer storage and dropped on producer deactivation.
Implementations§
Source§impl<'a> ProducerCtx<'a>
impl<'a> ProducerCtx<'a>
Sourcepub fn new(
node_id: NodeId,
core: &'a Core,
storage: &'a ProducerStorage,
) -> Self
pub fn new( node_id: NodeId, core: &'a Core, storage: &'a ProducerStorage, ) -> Self
Construct a new context for the binding’s invoke_fn dispatch
to call build closures. Internal — bindings call this; user
code receives the constructed ctx via the build closure’s arg.
Sourcepub fn core(&self) -> &Core
pub fn core(&self) -> &Core
The Core dispatcher. Sink closures use this to re-enter Core —
core.emit(self.node_id(), h) to emit a value, etc.
Sourcepub fn subscribe_to(&self, source: NodeId, sink: Sink)
pub fn subscribe_to(&self, source: NodeId, sink: Sink)
Subscribe sink to upstream source. The Subscription is
auto-tracked under the producer’s node_id; on producer
deactivation, the binding drops the storage entry, which drops
the Subscription, which unsubscribes the sink.
Auto Trait Implementations§
impl<'a> Freeze for ProducerCtx<'a>
impl<'a> !RefUnwindSafe for ProducerCtx<'a>
impl<'a> Send for ProducerCtx<'a>
impl<'a> Sync for ProducerCtx<'a>
impl<'a> Unpin for ProducerCtx<'a>
impl<'a> UnsafeUnpin for ProducerCtx<'a>
impl<'a> !UnwindSafe for ProducerCtx<'a>
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