pub struct JsonMaterialDb;Expand description
Manual JSON serialization/deserialization for a MaterialDatabase.
Does not use serde; produces and parses a simple human-readable JSON format.
Implementations§
Source§impl JsonMaterialDb
impl JsonMaterialDb
Sourcepub fn write_json_material(record: &MaterialRecord) -> String
pub fn write_json_material(record: &MaterialRecord) -> String
Serialize a MaterialRecord to a JSON object string.
Sourcepub fn parse_json_material(json: &str) -> Option<MaterialRecord>
pub fn parse_json_material(json: &str) -> Option<MaterialRecord>
Parse a single material record from a simplified JSON string.
Supports the format produced by write_json_material.
Auto Trait Implementations§
impl Freeze for JsonMaterialDb
impl RefUnwindSafe for JsonMaterialDb
impl Send for JsonMaterialDb
impl Sync for JsonMaterialDb
impl Unpin for JsonMaterialDb
impl UnsafeUnpin for JsonMaterialDb
impl UnwindSafe for JsonMaterialDb
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<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.