pub struct StreamDelta {
pub text: Option<String>,
pub usage: Option<Usage>,
pub stop_reason: Option<StopReason>,
pub done: bool,
}Expand description
One decoded piece of a streaming answer.
Providers interleave text with bookkeeping — token counts arrive at the end, stop reasons in their own frame — so a decoded frame may carry any combination of them, or nothing at all.
Fields§
§text: Option<String>§usage: Option<Usage>§stop_reason: Option<StopReason>§done: boolThe provider said this was the last frame.
Implementations§
Source§impl StreamDelta
impl StreamDelta
pub fn text(text: impl Into<String>) -> StreamDelta
pub fn nothing() -> StreamDelta
pub fn done() -> StreamDelta
pub fn with_usage(self, usage: Usage) -> StreamDelta
pub fn with_stop_reason(self, reason: StopReason) -> StreamDelta
Trait Implementations§
Source§impl Clone for StreamDelta
impl Clone for StreamDelta
Source§impl Debug for StreamDelta
impl Debug for StreamDelta
Source§impl Default for StreamDelta
impl Default for StreamDelta
Source§impl PartialEq for StreamDelta
impl PartialEq for StreamDelta
impl StructuralPartialEq for StreamDelta
Auto Trait Implementations§
impl Freeze for StreamDelta
impl RefUnwindSafe for StreamDelta
impl Send for StreamDelta
impl Sync for StreamDelta
impl Unpin for StreamDelta
impl UnsafeUnpin for StreamDelta
impl UnwindSafe for StreamDelta
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