pub struct ThreadHistoryBuilder { /* private fields */ }Implementations§
Source§impl ThreadHistoryBuilder
impl ThreadHistoryBuilder
pub fn new() -> Self
pub fn reset(&mut self)
pub fn finish(self) -> Vec<Turn>
pub fn active_turn_snapshot(&self) -> Option<Turn>
Sourcepub fn active_turn_id(&self) -> Option<&str>
pub fn active_turn_id(&self) -> Option<&str>
Returns the id of the active turn without materializing its items.
pub fn turn_snapshot(&self, turn_id: &str) -> Option<Turn>
Sourcepub fn active_turn_position(&self) -> Option<usize>
pub fn active_turn_position(&self) -> Option<usize>
Returns the index of the active turn snapshot within the finished turn list.
When a turn is still open, this is the index it will occupy after
finish. When no turn is open, it is the index of the last finished turn.
pub fn has_active_turn(&self) -> bool
pub fn active_turn_id_if_explicit(&self) -> Option<String>
pub fn active_turn_start_index(&self) -> Option<usize>
Sourcepub fn handle_event(&mut self, event: &EventMsg)
pub fn handle_event(&mut self, event: &EventMsg)
Shared reducer for persisted rollout replay and in-memory current-turn tracking used by running thread resume/rejoin.
This function should handle all EventMsg variants that can be persisted in a rollout file.
See should_persist_event_msg in codex-rs/core/rollout/policy.rs.
pub fn handle_rollout_item(&mut self, item: &RolloutItem)
Sourcepub fn handle_event_with_changes(
&mut self,
event: &EventMsg,
) -> ThreadHistoryChangeSet
pub fn handle_event_with_changes( &mut self, event: &EventMsg, ) -> ThreadHistoryChangeSet
Handles one event and returns the materialized items or turn metadata changed by that event.
Sourcepub fn handle_rollout_item_with_changes(
&mut self,
item: &RolloutItem,
) -> ThreadHistoryChangeSet
pub fn handle_rollout_item_with_changes( &mut self, item: &RolloutItem, ) -> ThreadHistoryChangeSet
Handles a rollout item and returns the materialized items or turn metadata changed by that one append.
Sourcepub fn handle_rollout_items_with_changes(
&mut self,
items: &[RolloutItem],
) -> ThreadHistoryChangeSet
pub fn handle_rollout_items_with_changes( &mut self, items: &[RolloutItem], ) -> ThreadHistoryChangeSet
Handles rollout items in order and returns a coalesced end-of-batch change set. Multiple changes to the same item or turn are deduplicated so only the latest snapshot is emitted.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThreadHistoryBuilder
impl RefUnwindSafe for ThreadHistoryBuilder
impl Send for ThreadHistoryBuilder
impl Sync for ThreadHistoryBuilder
impl Unpin for ThreadHistoryBuilder
impl UnsafeUnpin for ThreadHistoryBuilder
impl UnwindSafe for ThreadHistoryBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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