pub struct StreamTextResult<O> { /* private fields */ }Expand description
Result of a streaming call: one event stream plus a completion handle.
The stream must be consumed for the call to progress. Use
split to forward events in one task and await the
completion in another, or one of the consuming views.
Implementations§
Source§impl<O> StreamTextResult<O>
impl<O> StreamTextResult<O>
Sourcepub fn split(self) -> (EventStream, Completion<O>)
pub fn split(self) -> (EventStream, Completion<O>)
Splits the result into the event stream and the completion handle.
Sourcepub fn events(&mut self) -> &mut EventStream
pub fn events(&mut self) -> &mut EventStream
The event stream.
Source§impl<O: Send + 'static> StreamTextResult<O>
impl<O: Send + 'static> StreamTextResult<O>
Sourcepub fn text_stream(self) -> impl Stream<Item = Result<String, Error>> + Send
pub fn text_stream(self) -> impl Stream<Item = Result<String, Error>> + Send
Consumes the result, yielding text deltas only. The final item is an error when the call failed.
Sourcepub fn partial_output_stream(
self,
) -> impl Stream<Item = PartialOutput<O>> + Send
pub fn partial_output_stream( self, ) -> impl Stream<Item = PartialOutput<O>> + Send
Consumes the result, yielding the structured output as it grows.
Only the first text part of each step is parsed; a value is published
whenever the repaired partial JSON changes. Errors are not reported
here: use consume or the completion for them.
Source§impl<O> StreamTextResult<O>
impl<O> StreamTextResult<O>
Trait Implementations§
Auto Trait Implementations§
impl<O> !RefUnwindSafe for StreamTextResult<O>
impl<O> !Sync for StreamTextResult<O>
impl<O> !UnwindSafe for StreamTextResult<O>
impl<O> Freeze for StreamTextResult<O>
impl<O> Send for StreamTextResult<O>
impl<O> Unpin for StreamTextResult<O>
impl<O> UnsafeUnpin for StreamTextResult<O>
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