#[non_exhaustive]pub struct ConversationSnapshot {
pub version: u32,
pub messages: Vec<Message>,
pub pinned: Vec<bool>,
}Expand description
Persistable image of a conversation’s logical state.
Carries only the data needed to rebuild a Conversation’s history:
the message vector and the parallel pinned mask. Runtime state
(model, tools, middlewares, per-turn Usage / RunId) is
deliberately excluded — the model is re-supplied at resume time and
telemetry is the caller’s concern.
Versioned via version so the on-disk shape can evolve without
breaking older payloads. Today only version == 1 is accepted;
deserializing any other value fails with an explicit error.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.version: u32Wire-format version. Set by ConversationSnapshot::new to
ConversationSnapshot::VERSION; deserializing any other
value rejects the payload at parse time so callers fail loudly
on a forward-incompatible file.
messages: Vec<Message>History messages, in chronological order.
pinned: Vec<bool>Parallel pin mask — pinned[i] is the survivor flag for
messages[i]. Same length as messages; the
#[serde(try_from)] arm rejects payloads where the two
vectors disagree, so post-deserialize the invariant holds.
Implementations§
Source§impl ConversationSnapshot
impl ConversationSnapshot
Sourcepub const VERSION: u32 = 1
pub const VERSION: u32 = 1
Current wire-format version. Bumped when the on-disk shape changes in a backward-incompatible way; older payloads then fail to deserialize until a migration step lands.
Sourcepub fn new(
messages: Vec<Message>,
pinned: Vec<bool>,
) -> Result<ConversationSnapshot, FromMessagesError>
pub fn new( messages: Vec<Message>, pinned: Vec<bool>, ) -> Result<ConversationSnapshot, FromMessagesError>
Bundle messages and pinned into a snapshot tagged with
the current VERSION. Returns
FromMessagesError::LengthMismatch when the two vectors
disagree — same invariant the deserialize path enforces, so
snapshots produced via this constructor always round-trip.
Trait Implementations§
Source§impl Clone for ConversationSnapshot
impl Clone for ConversationSnapshot
Source§fn clone(&self) -> ConversationSnapshot
fn clone(&self) -> ConversationSnapshot
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 ConversationSnapshot
impl Debug for ConversationSnapshot
Source§impl<'de> Deserialize<'de> for ConversationSnapshot
impl<'de> Deserialize<'de> for ConversationSnapshot
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConversationSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConversationSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ConversationSnapshot
impl PartialEq for ConversationSnapshot
Source§fn eq(&self, other: &ConversationSnapshot) -> bool
fn eq(&self, other: &ConversationSnapshot) -> bool
self and other values to be equal, and is used by ==.