pub struct StreamState {
pub status: StreamStatus,
pub text: String,
pub reasoning: String,
pub error: Option<ModelError>,
/* private fields */
}Expand description
Retained presentation state for one inference attempt. Deltas are inert;
only response() exposes a validated, completed turn for dispatch. There is
deliberately no automatic retry: callers keep committed conversation/results
and start new inference rather than re-executing a previous action batch.
Fields§
§status: StreamStatus§text: String§reasoning: String§error: Option<ModelError>Implementations§
Source§impl StreamState
impl StreamState
Sourcepub fn apply(&mut self, event: &StreamEvent)
pub fn apply(&mut self, event: &StreamEvent)
Terminal states are sticky, including cancellation racing a late finish.
Sourcepub fn fail(&mut self, error: ModelError)
pub fn fail(&mut self, error: ModelError)
Called on EOF, missing final frame or watchdog expiration. Partial prose and reasoning remain available, but no calls become executable.
pub fn cancel(&mut self)
pub fn response(&self) -> Option<&ModelResponse>
Sourcepub fn continue_text(
&self,
history: &Conversation,
max_output_tokens: u32,
) -> Result<ModelRequest, ModelError>
pub fn continue_text( &self, history: &Conversation, max_output_tokens: u32, ) -> Result<ModelRequest, ModelError>
Explicit prose-only continuation. Uses committed history plus retained answer text, never partial tool arguments or reasoning. Tools are disabled so continuation cannot replay an action. The original history is unchanged.
§Errors
Rejects states without a truncated, nonempty prose answer.
Trait Implementations§
Source§impl Clone for StreamState
impl Clone for StreamState
Source§fn clone(&self) -> StreamState
fn clone(&self) -> StreamState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamState
impl Debug for StreamState
Source§impl Default for StreamState
impl Default for StreamState
Source§fn default() -> StreamState
fn default() -> StreamState
Source§impl<'de> Deserialize<'de> for StreamState
impl<'de> Deserialize<'de> for StreamState
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StreamState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for StreamState
impl PartialEq for StreamState
Source§impl Serialize for StreamState
impl Serialize for StreamState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for StreamState
Auto Trait Implementations§
impl Forget for StreamState
impl Freeze for StreamState
impl Move for StreamState
impl RefUnwindSafe for StreamState
impl Send for StreamState
impl Sync for StreamState
impl Unpin for StreamState
impl UnsafeUnpin for StreamState
impl UnwindSafe for StreamState
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more