Skip to main content

ProducerCtx

Struct ProducerCtx 

Source
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 resulting Subscription is auto-tracked under node_id in the binding’s producer storage and dropped on producer deactivation.

Implementations§

Source§

impl<'a> ProducerCtx<'a>

Source

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.

Source

pub fn node_id(&self) -> NodeId

The producer node’s id.

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.