1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Errors produced by the in-memory state-series collection.
//!
//! This module describes only failures that arise while organizing owned
//! [`SystemState`](crate::system_state::SystemState) values for analysis. JSON
//! encoding, payload reconstruction, metadata validation, filesystem access,
//! chunk management, and writer lifecycles belong to the separate storage
//! module and deliberately do not appear in [`StateSeriesError`].
//!
//! # Invariant failures
//!
//! A [`StateSeries`](super::state_series::StateSeries) accepts a state only when it
//! shares the series' exact immutable layout allocation and has a simulation
//! iteration greater than the current final iteration. These requirements make layout
//! checks constant-time and preserve one unambiguous iteration order while
//! still allowing gaps between sampled indices.
//!
//! # Analysis access failures
//!
//! Immutable state lookup follows ordinary slice conventions and returns an
//! `Option`. The narrow mutable analysis boundary needs richer diagnostics
//! because it validates both a series position and a typed state field.
//! [`StateSeriesError::PositionOutOfBounds`] identifies the former, while
//! [`StateSeriesError::PayloadAccess`] adds the series position to the original
//! [`StateError`] without discarding its source-chain information.
use Error;
use crateStateError;
/// A failure produced while maintaining or mutating an in-memory state series.
///
/// The enum is intentionally small and independent of persistence. Every
/// variant is either a collection invariant violation or contextualized typed
/// access into one already-stored state.
///
/// `StateSeriesError` is non-exhaustive so additional analysis invariants can be
/// introduced without forcing downstream crates to use exhaustive matches.
/// Callers should therefore retain a fallback match arm.