Skip to main content

ProducerEmitter

Struct ProducerEmitter 

Source
pub struct ProducerEmitter { /* private fields */ }
Expand description

The owner-side producer handle (D249/S2c). MailboxEmitter (the Send cross-thread emit side) plus the owner-only !Send Rc<DeferQueue> for Self::defer. Captured into owner-side !Send producer sinks (control/higher-order dynamic-inner); the Rc makes it !Send, consistent with the D248 single-owner Sink relaxation. A timer task that needs only the cross-thread emit side takes Self::emitter (a Send MailboxEmitter) instead.

Implementations§

Source§

impl ProducerEmitter

Source

pub fn for_core(core: &Core) -> Self

Construct directly from any &Core (S2b). Used by the binding-layer RAII convenience (D228-A): a test harness / napi BenchCore that co-owns the Core builds a SubGuard over core.subscribe(...)’s returned SubscriptionId so drop schedules the unsubscribe — the sanctioned replacement for the retired core-level RAII Subscription.

Source

pub fn from_corefull(core: &dyn CoreFull) -> Self

Construct from the object-safe CoreFull facade (D246 r5 / D245). Used by ProducerCtx::emitter now that the ctx holds &dyn CoreFull rather than a concrete &Core.

Source

pub fn emitter(&self) -> MailboxEmitter

The Send cross-thread emit sub-handle — for autonomous timer tasks (temporal.rs, tokio::spawn) that only emit/complete/ error and must keep their spawned future Send (D249/S2c).

Source

pub fn emit_or_defer(&self, node_id: NodeId, handle: HandleId)

Post an Emit. If the owning Core is gone, release handle (it held a retain for the would-be payload) — no leak.

Source

pub fn complete_or_defer(&self, node_id: NodeId)

Post a Complete. No payload handle; Core-gone is a no-op.

Source

pub fn error_or_defer(&self, node_id: NodeId, handle: HandleId)

Post an Error. If the owning Core is gone, release the error payload handle — no leak.

Source

pub fn defer(&self, f: impl FnOnce(&dyn CoreFull) + 'static) -> bool

Post an owner-side closure (D233) given the full object-safe Core surface — for sinks that must perform value-returning topology mutation (windowing create_window_node, higher-order dynamic-inner subscribe). Runs in-wave (the drain loop holds &Core); the closure consumes any returned NodeId/SubscriptionId to drive its captured op-state.

Returns false iff the owning Core is already gone — the closure is dropped unrun (running CoreFull on a half-dropped Core is unsound; user-locked QA decision A). QA F2 (2026-05-18): this now surfaces the Core-gone signal (was a silent let _ = …) so a caller whose closure captured retained HandleIds can release them on false — mirroring the emit_or_defer / error_or_defer release-on-false contract. The not-yet-written windowing / higher-order callers MUST honour this (release captured payload handles when it returns false).

Source

pub fn is_core_gone(&self) -> bool

Whether the owning Core has dropped (mailbox closed). Lets a long-lived task stop promptly + release any handle it holds (preserves the old WeakCore::upgrade() == None promptness). NOT required for leak-safety (*_or_defer already releases on a closed post) — only for prompt task shutdown.

Trait Implementations§

Source§

impl Clone for ProducerEmitter

Source§

fn clone(&self) -> ProducerEmitter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.