fugue_evo/checkpoint/mod.rs
1//! Checkpointing support for evolution state persistence
2//!
3//! This module provides serialization and recovery of evolution state,
4//! enabling long-running experiments to be paused and resumed.
5//!
6//! The `state` submodule (data structures) is always available.
7//! The `recovery` submodule (file I/O) requires the `checkpoint` feature **and
8//! a target with a filesystem**.
9//!
10//! The second half of that condition is not a new restriction, it is the one
11//! [`CheckpointError`](crate::error::CheckpointError) already encodes: its
12//! `Io` variant is `#[cfg(not(target_arch = "wasm32"))]` and its docs read
13//! "native only", with `Storage(String)` offered as the wasm alternative. The
14//! module gate had not been kept in step, so on `wasm32` the file-I/O code was
15//! still compiled while the error variant its `?` operators desugar into was
16//! not — `cargo check --target wasm32-unknown-unknown` failed on the default
17//! feature set with a dozen "`?` couldn't convert the error to
18//! `CheckpointError`".
19//!
20//! Gating the module rather than adding a wasm `From<io::Error>` is the fix
21//! that matches the intent: `wasm32-unknown-unknown` has no filesystem, so
22//! `File::create` there could only ever be a compile-time promise of a
23//! runtime failure.
24#[cfg(all(feature = "checkpoint", not(target_arch = "wasm32")))]
25mod recovery;
26mod rng;
27mod state;
28
29#[cfg(all(feature = "checkpoint", not(target_arch = "wasm32")))]
30pub use recovery::*;
31pub use rng::*;
32pub use state::*;
33
34/// Prelude for checkpoint module
35pub mod prelude {
36 #[cfg(all(feature = "checkpoint", not(target_arch = "wasm32")))]
37 pub use super::recovery::*;
38 pub use super::rng::*;
39 pub use super::state::*;
40}