Skip to main content

model_from_json

Function model_from_json 

Source
pub fn model_from_json(text: &str) -> FemmResult<ModelSummary>
Expand description

Decodes a model’s JSON summary form into a ModelSummary.

§Examples

use sim_lib_femm_codec::model_from_json;

let text = "{\"id\":7,\"name\":\"plate\",\"physics\":\"electrostatic\",\
             \"formulation\":\"planar\",\"params\":[\"gap-mm\"]}";
let summary = model_from_json(text).unwrap();
assert_eq!(summary.id, 7);
assert_eq!(summary.formulation, "planar");
assert_eq!(summary.params, vec!["gap-mm".to_owned()]);