pub struct SessionJournal {
pub entries: Vec<SessionEntry>,
pub leaf_id: Option<EntryId>,
pub schema_version: u32,
pub spawn_depth: u32,
}Fields§
§entries: Vec<SessionEntry>§leaf_id: Option<EntryId>§schema_version: u32§spawn_depth: u32Implementations§
Source§impl SessionJournal
impl SessionJournal
pub fn new() -> Self
pub fn with_spawn_depth(depth: u32) -> Self
pub fn append(&mut self, kind: SessionEntryKind) -> EntryId
pub fn append_message(&mut self, message: Message) -> EntryId
pub fn append_compaction( &mut self, summary: String, tokens_before: Option<u64>, tokens_after: Option<u64>, model: Option<String>, ) -> EntryId
pub fn append_branch_summary( &mut self, branch_id: String, summary: String, parent_branch_id: Option<String>, ) -> EntryId
pub fn branch_to(&mut self, entry_id: &str) -> Result<(), String>
pub fn fork_from(&self, from_entry_id: Option<&str>) -> Result<Self, String>
pub fn index(&self) -> HashMap<&str, &SessionEntry>
pub fn children_of(&self, parent_id: Option<&str>) -> Vec<&SessionEntry>
pub fn contains(&self, entry_id: &str) -> bool
pub fn leaf(&self) -> Option<&SessionEntry>
pub fn root_to_leaf(&self) -> Vec<&SessionEntry>
pub fn active_messages(&self, include_system: bool) -> Vec<Message>
pub fn leaves(&self) -> Vec<&SessionEntry>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn validate(&self) -> Result<(), String>
pub fn from_messages(messages: Vec<Message>, spawn_depth: u32) -> Self
pub fn to_messages(&self) -> Vec<Message>
Sourcepub fn rebranch_active_messages(&mut self, messages: &[Message])
pub fn rebranch_active_messages(&mut self, messages: &[Message])
Make messages the active projection without rewriting the journal.
The existing active branch remains as evidence. We reuse its longest unchanged prefix, then append the repaired suffix as a sibling branch.
Trait Implementations§
Source§impl Clone for SessionJournal
impl Clone for SessionJournal
Source§fn clone(&self) -> SessionJournal
fn clone(&self) -> SessionJournal
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionJournal
impl Debug for SessionJournal
Source§impl Default for SessionJournal
impl Default for SessionJournal
Source§fn default() -> SessionJournal
fn default() -> SessionJournal
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SessionJournal
impl<'de> Deserialize<'de> for SessionJournal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SessionJournal
impl PartialEq for SessionJournal
Source§impl Serialize for SessionJournal
impl Serialize for SessionJournal
impl StructuralPartialEq for SessionJournal
Auto Trait Implementations§
impl Freeze for SessionJournal
impl RefUnwindSafe for SessionJournal
impl Send for SessionJournal
impl Sync for SessionJournal
impl Unpin for SessionJournal
impl UnsafeUnpin for SessionJournal
impl UnwindSafe for SessionJournal
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
Converts
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> ⓘ
Converts
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