pub struct StreamHandle<S: State> {
pub stream: Pin<Box<dyn Stream<Item = Result<StreamEvent<S>, JunctureError>> + Send>>,
/* private fields */
}Expand description
Result of a streaming graph execution.
Contains the run identifier for tracking and resumption, alongside the
event stream produced by the Pregel engine. Callers use run_id
to correlate events with a specific invocation or to resume a stream that was
interrupted.
§Examples
ⓘ
use juncture_core::{StateGraph, State, StreamMode};
use futures::StreamExt;
let handle = compiled.stream(initial_state, &config, StreamMode::Values).await?;
println!("run_id = {}", handle.run_id());
let mut stream = handle.stream;
while let Some(result) = stream.next().await {
// process events
}Fields§
§stream: Pin<Box<dyn Stream<Item = Result<StreamEvent<S>, JunctureError>> + Send>>Stream of graph execution events.
Implementations§
Source§impl<S: State> StreamHandle<S>
impl<S: State> StreamHandle<S>
Sourcepub fn into_parts(
self,
) -> (String, Pin<Box<dyn Stream<Item = Result<StreamEvent<S>, JunctureError>> + Send>>)
pub fn into_parts( self, ) -> (String, Pin<Box<dyn Stream<Item = Result<StreamEvent<S>, JunctureError>> + Send>>)
Consumes the handle, returning the run ID and stream as a tuple.
Trait Implementations§
Auto Trait Implementations§
impl<S> !RefUnwindSafe for StreamHandle<S>
impl<S> !Sync for StreamHandle<S>
impl<S> !UnwindSafe for StreamHandle<S>
impl<S> Freeze for StreamHandle<S>
impl<S> Send for StreamHandle<S>
impl<S> Unpin for StreamHandle<S>
impl<S> UnsafeUnpin for StreamHandle<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