#[non_exhaustive]pub struct StateSnapshot<S: State> {
pub state: S,
pub checkpoint_id: String,
pub step: u32,
pub thread_id: String,
pub parent_checkpoint_id: Option<String>,
pub created_at: SystemTime,
pub next_nodes: Vec<String>,
}Expand description
Complete snapshot of graph execution state at a point in time.
Used for:
- Human-in-the-loop: show state to human before they decide to resume
- Time travel: inspect or resume from any past checkpoint
- Debugging: see what the state looked like at each superstep
§Example
ⓘ
let snapshot = graph.get_state("thread-1").await?;
if let Some(snap) = snapshot {
println!("Step {}: next nodes = {:?}", snap.step, snap.next_nodes);
}NOTE: #[non_exhaustive] — will grow with metadata, branch info, etc.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.state: SThe full state at this checkpoint.
checkpoint_id: StringUnique identifier for this checkpoint.
step: u32Which superstep this was taken at.
thread_id: StringThread this checkpoint belongs to.
parent_checkpoint_id: Option<String>The checkpoint this one was derived from (if any).
created_at: SystemTimeWhen this checkpoint was created.
next_nodes: Vec<String>Which nodes are scheduled to run next. Empty if the graph completed or hit recursion limit.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for StateSnapshot<S>where
S: Freeze,
impl<S> RefUnwindSafe for StateSnapshot<S>where
S: RefUnwindSafe,
impl<S> Send for StateSnapshot<S>
impl<S> Sync for StateSnapshot<S>
impl<S> Unpin for StateSnapshot<S>where
S: Unpin,
impl<S> UnsafeUnpin for StateSnapshot<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for StateSnapshot<S>where
S: UnwindSafe,
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