pub struct StreamWriter<S: State> { /* private fields */ }Expand description
Writer for streaming events from a node
Nodes receive this writer to emit custom streaming events during execution. The writer carries a sender channel, the current node name, stream mode, and namespace stack for subgraph isolation.
Implementations§
Source§impl<S: State> StreamWriter<S>
impl<S: State> StreamWriter<S>
Sourcepub const fn new(
tx: Sender<StreamEvent<S>>,
node: String,
mode: StreamMode,
) -> Self
pub const fn new( tx: Sender<StreamEvent<S>>, node: String, mode: StreamMode, ) -> Self
Create a new writer backed by a real channel
Sourcepub const fn disconnected(node: String, mode: StreamMode) -> Self
pub const fn disconnected(node: String, mode: StreamMode) -> Self
Create a disconnected writer (no-op send)
Used when streaming is not configured for the current execution.
Sourcepub fn with_ns(&self, ns_segment: String) -> Self
pub fn with_ns(&self, ns_segment: String) -> Self
Create a child writer with an additional namespace segment (for subgraphs)
Sourcepub async fn send(&self, data: Value)
pub async fn send(&self, data: Value)
Send a custom stream event through the channel.
Silently drops the event if the writer is disconnected or the event
does not match the configured StreamMode.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for StreamWriter<S>
impl<S> RefUnwindSafe for StreamWriter<S>
impl<S> Send for StreamWriter<S>
impl<S> Sync for StreamWriter<S>
impl<S> Unpin for StreamWriter<S>
impl<S> UnsafeUnpin for StreamWriter<S>
impl<S> UnwindSafe for StreamWriter<S>
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