Skip to main content

Module serial

Module serial 

Source
Expand description

Saving and loading distributions: Dist::to_json and Dist::from_json, a versioned JSON document per distribution.

The document holds the family and the parameters the family’s constructor takes, so a loaded distribution is rebuilt by the same validated constructor and equals the saved one. Numbers round-trip bit for bit; a non-finite value is written as "NaN", "inf" or "-inf". A mixture is saved with its components, so it must have been built from native severities (Mixture::from_dists, which the bindings use). A Custom cannot be saved: it is a function in the caller’s language.

{"format": "risk_rs.distribution", "format_version": 1,
 "family": "lognormal", "meanlog": 7.0, "sdlog": 0.5}