feat: add serde serialization support behind serde feature flag
Add Serialize/Deserialize derives to all public data types (ParamValue, Distribution, Direction, TrialState, ParamId, AttrValue, CompletedTrial) gated behind a `serde` feature flag. Introduce StudySnapshot struct and Study::save()/Study::load() for persisting and restoring study state as human-readable JSON.
This commit is contained in:
@@ -15,6 +15,7 @@ use crate::types::TrialState;
|
||||
|
||||
/// A user attribute value that can be stored on a trial.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum AttrValue {
|
||||
/// A floating-point attribute.
|
||||
Float(f64),
|
||||
|
||||
Reference in New Issue
Block a user