pub struct StreamChunk {
pub run_id: String,
pub task_run_id: String,
pub index: Option<i64>,
pub payload: String,
}Expand description
One chunk of a run’s output, as
Context::put_stream published it.
The payload is whatever the handler wrote. It goes out as bytes and comes
back as a String, because that is what the two sides of the wire are
(PutStreamEventRequest.message is bytes, WorkflowEvent.event_payload
is string); see put_stream for what that
does to bytes that are not UTF-8.
let mut chunks = client.runs().stream("d627fab0-385f-4eb4-98f9-59a783bc8631").await?;
if let Some(Ok(chunk)) = chunks.next().await {
println!("run {} task {}: [{:?}] {}", chunk.run_id, chunk.task_run_id, chunk.index, chunk.payload);
}Fields§
§run_id: StringThe run the chunk belongs to. Worth reading when one subscription
covers several runs — see
RunsClient::stream_by_metadata.
task_run_id: StringThe task run that published it. A workflow run has one sequence of chunks per task, so this is what tells two interleaved outputs apart.
index: Option<i64>The chunk’s number in its task run’s sequence, counted from zero, when
the engine sent one. None means the engine did not — the field is
optional on the wire — and such chunks are handed over in arrival order
without any ordering guarantee.
payload: StringWhat the handler published.
Trait Implementations§
Source§impl Clone for StreamChunk
impl Clone for StreamChunk
Source§impl Debug for StreamChunk
impl Debug for StreamChunk
impl Eq for StreamChunk
Source§impl PartialEq for StreamChunk
impl PartialEq for StreamChunk
impl StructuralPartialEq for StreamChunk
Auto Trait Implementations§
impl Forget for StreamChunk
impl Freeze for StreamChunk
impl Move for StreamChunk
impl RefUnwindSafe for StreamChunk
impl Send for StreamChunk
impl Sync for StreamChunk
impl Unpin for StreamChunk
impl UnsafeUnpin for StreamChunk
impl UnwindSafe for StreamChunk
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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