pub struct Simulation {
pub schema: u32,
pub active: Option<String>,
pub studies: Vec<Study>,
pub id_counter: u64,
}Fields§
§schema: u32§active: Option<String>The study the workbench shows.
studies: Vec<Study>§id_counter: u64Implementations§
Source§impl Simulation
impl Simulation
Sourcepub fn from_value(value: &Value) -> Result<Self, String>
pub fn from_value(value: &Value) -> Result<Self, String>
Read the block from its JSON, validated.
Sourcepub fn from_document(document: &Value) -> Result<Option<Self>, String>
pub fn from_document(document: &Value) -> Result<Option<Self>, String>
Read the block out of a whole document, if it has one.
pub fn to_value(&self) -> Value
Sourcepub fn next_id(&mut self, prefix: &str) -> String
pub fn next_id(&mut self, prefix: &str) -> String
A fresh id with prefix (SIM study, MOT motor, CLP clip).
Sourcepub fn add_study(&mut self, name: &str) -> String
pub fn add_study(&mut self, name: &str) -> String
Add an empty study named name (numbered when empty), make it active
and return its id.
pub fn study(&self, id: &str) -> Option<&Study>
pub fn study_mut(&mut self, id: &str) -> Option<&mut Study>
Sourcepub fn active_study(&self) -> Option<&Study>
pub fn active_study(&self) -> Option<&Study>
The active study, else the first.
Trait Implementations§
Source§impl Clone for Simulation
impl Clone for Simulation
Source§impl Debug for Simulation
impl Debug for Simulation
Source§impl Default for Simulation
impl Default for Simulation
Source§impl<'de> Deserialize<'de> for Simulation
impl<'de> Deserialize<'de> for Simulation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Simulation
impl PartialEq for Simulation
Source§impl Serialize for Simulation
impl Serialize for Simulation
impl StructuralPartialEq for Simulation
Auto Trait Implementations§
impl Forget for Simulation
impl Freeze for Simulation
impl RefUnwindSafe for Simulation
impl Send for Simulation
impl Sync for Simulation
impl Unpin for Simulation
impl UnsafeUnpin for Simulation
impl UnwindSafe for Simulation
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