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
impl ProducerEmitter
Sourcepub fn for_core(core: &Core) -> Self
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.
Sourcepub fn from_corefull(core: &dyn CoreFull) -> Self
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.
Sourcepub fn emitter(&self) -> MailboxEmitter
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).
Sourcepub fn emit_or_defer(&self, node_id: NodeId, handle: HandleId)
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.
Sourcepub fn complete_or_defer(&self, node_id: NodeId)
pub fn complete_or_defer(&self, node_id: NodeId)
Post a Complete. No payload handle; Core-gone is a no-op.
Sourcepub fn error_or_defer(&self, node_id: NodeId, handle: HandleId)
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.
Sourcepub fn defer(&self, f: impl FnOnce(&dyn CoreFull) + 'static) -> bool
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).
Sourcepub fn is_core_gone(&self) -> bool
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
impl Clone for ProducerEmitter
Source§fn clone(&self) -> ProducerEmitter
fn clone(&self) -> ProducerEmitter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more