pub struct DatabaseSerializer;Expand description
Serialize/deserialize SimulationRecord to a simple JSON-like text format.
The format is:
{"name":"`n`","timestamp":`t`,"params":{"k1":"v1",...},"output":"`path`"}Implementations§
Source§impl DatabaseSerializer
impl DatabaseSerializer
Sourcepub fn serialize(&self, rec: &SimulationRecord) -> String
pub fn serialize(&self, rec: &SimulationRecord) -> String
Serialize a SimulationRecord to a JSON-like string.
Sourcepub fn serialize_all(&self, recs: &[&SimulationRecord]) -> String
pub fn serialize_all(&self, recs: &[&SimulationRecord]) -> String
Serialize a list of records to a JSON array string.
Sourcepub fn deserialize(&self, s: &str) -> Option<SimulationRecord>
pub fn deserialize(&self, s: &str) -> Option<SimulationRecord>
Deserialize a single record from a JSON-like string.
Uses minimal parsing; fields must appear in the order produced by
serialize. Returns None on parse failure.
Trait Implementations§
Source§impl Clone for DatabaseSerializer
impl Clone for DatabaseSerializer
Source§fn clone(&self) -> DatabaseSerializer
fn clone(&self) -> DatabaseSerializer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DatabaseSerializer
impl Debug for DatabaseSerializer
Source§impl Default for DatabaseSerializer
impl Default for DatabaseSerializer
Source§fn default() -> DatabaseSerializer
fn default() -> DatabaseSerializer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DatabaseSerializer
impl RefUnwindSafe for DatabaseSerializer
impl Send for DatabaseSerializer
impl Sync for DatabaseSerializer
impl Unpin for DatabaseSerializer
impl UnsafeUnpin for DatabaseSerializer
impl UnwindSafe for DatabaseSerializer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.