Skip to main content

ConversationState

Trait ConversationState 

Source
pub trait ConversationState: Send {
    // Required methods
    fn messages(&self) -> &[Message];
    fn append(&mut self, message: Message);
    fn replace(&mut self, messages: Vec<Message>);

    // Provided method
    fn token_estimate(&self) -> u64 { ... }
}
Expand description

Mutable conversation backing a turn or session.

Required Methods§

Source

fn messages(&self) -> &[Message]

Immutable view of messages.

Source

fn append(&mut self, message: Message)

Append a message.

Source

fn replace(&mut self, messages: Vec<Message>)

Replace the entire message list (compaction / restore).

Provided Methods§

Source

fn token_estimate(&self) -> u64

Token estimate for compaction triggers (aligned with preflight, W3.2).

Includes framing, multimodal parts, and tool-call argument JSON.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§