pub struct Stream<T> { /* private fields */ }Expand description
Defines a typed best-effort resumable message Stream owned by one Flow type.
Register the same definition in exactly one crate::PersistenceSchema. Clones share
identity and may be used at Client and Step call sites.
Implementations§
Source§impl<T> Stream<T>
impl<T> Stream<T>
Sourcepub fn new(name: impl Into<String>, stream_capacity_bytes: i64) -> Self
pub fn new(name: impl Into<String>, stream_capacity_bytes: i64) -> Self
Creates a Stream with a positive approximate budget shared by all instances of its Flow.
§Panics
Panics when name is empty or stream_capacity_bytes is not positive.
Sourcepub fn stream_capacity_bytes(&self) -> i64
pub fn stream_capacity_bytes(&self) -> i64
Returns the approximate shared byte budget.
Sourcepub fn write(&self, context: &mut Context, value: T) -> HandlerResult<()>where
T: Value,
pub fn write(&self, context: &mut Context, value: T) -> HandlerResult<()>where
T: Value,
Appends one message immediately from the current Step execution.
§Errors
Returns crate::HandlerError for RPC or Flow timeout Contexts, unregistered Streams,
encoding failures, cancellation, or a closed Worker output stream. Dex storage failures are
not acknowledged.
Source§impl Stream<String>
impl Stream<String>
Sourcepub fn buffered_text(
&self,
context: &mut Context,
) -> HandlerResult<BufferedTextStream>
pub fn buffered_text( &self, context: &mut Context, ) -> HandlerResult<BufferedTextStream>
Creates an invocation-managed writer with a one-second interval and 16 KiB threshold.
The Worker flushes remaining text before the handler result or error. The writer preserves chunks exactly, ignores empty chunks, and never splits a chunk.
§Errors
Returns HandlerError unless this registered String Stream is used by an active Step.
Sourcepub fn buffered_text_with_options(
&self,
context: &mut Context,
options: BufferedTextStreamOptions,
) -> HandlerResult<BufferedTextStream>
pub fn buffered_text_with_options( &self, context: &mut Context, options: BufferedTextStreamOptions, ) -> HandlerResult<BufferedTextStream>
Creates an invocation-managed writer with explicit buffering settings.
§Errors
Returns HandlerError for invalid settings, an unregistered Stream, cancellation, or a
Context that does not belong to a Step.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Stream<T>
impl<T> RefUnwindSafe for Stream<T>
impl<T> Send for Stream<T>
impl<T> Sync for Stream<T>
impl<T> Unpin for Stream<T>
impl<T> UnsafeUnpin for Stream<T>
impl<T> UnwindSafe for Stream<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request