Struct sim::simulator::web::Simulation
source · pub struct Simulation { /* private fields */ }
Expand description
The web Simulation
provides JS/WASM-compatible interfaces to the core
Simulation
struct. For additional insight on these methods, refer to
the associated core Simulation
methods. Errors are unwrapped, instead
of returned, in the web Simulation
methods.
Implementations§
source§impl Simulation
impl Simulation
sourcepub fn post_json(models: &str, connectors: &str) -> Self
pub fn post_json(models: &str, connectors: &str) -> Self
A JS/WASM interface for Simulation.post
, which uses JSON
representations of the simulation models and connectors.
sourcepub fn put_json(&mut self, models: &str, connectors: &str)
pub fn put_json(&mut self, models: &str, connectors: &str)
A JS/WASM interface for Simulation.put
, which uses JSON
representations of the simulation models and connectors.
sourcepub fn get_json(&self) -> String
pub fn get_json(&self) -> String
Get a JSON representation of the full Simulation
configuration.
sourcepub fn post_yaml(models: &str, connectors: &str) -> Simulation
pub fn post_yaml(models: &str, connectors: &str) -> Simulation
A JS/WASM interface for Simulation.post
, which uses YAML
representations of the simulation models and connectors.
sourcepub fn put_yaml(&mut self, models: &str, connectors: &str)
pub fn put_yaml(&mut self, models: &str, connectors: &str)
A JS/WASM interface for Simulation.put
, which uses YAML
representations of the simulation models and connectors.
sourcepub fn get_yaml(&self) -> String
pub fn get_yaml(&self) -> String
Get a YAML representation of the full Simulation
configuration.
sourcepub fn get_messages_js(&self) -> Array
pub fn get_messages_js(&self) -> Array
A JS/WASM interface for Simulation.get_messages
, which converts the
messages to a JavaScript Array.
sourcepub fn get_messages_json(&self) -> String
pub fn get_messages_json(&self) -> String
A JS/WASM interface for Simulation.get_messages
, which converts the
messages to a JSON string.
sourcepub fn get_messages_yaml(&self) -> String
pub fn get_messages_yaml(&self) -> String
A JS/WASM interface for Simulation.get_messages
, which converts the
messages to a YAML string.
sourcepub fn get_global_time(&self) -> f64
pub fn get_global_time(&self) -> f64
An interface to Simulation.get_global_time
.
sourcepub fn get_status(&self, model_id: &str) -> String
pub fn get_status(&self, model_id: &str) -> String
An interface to Simulation.get_status
.
sourcepub fn get_records_json(&self, model_id: &str) -> String
pub fn get_records_json(&self, model_id: &str) -> String
A JS/WASM interface for Simulation.records
, which converts the
records to a JSON string.
sourcepub fn get_records_yaml(&self, model_id: &str) -> String
pub fn get_records_yaml(&self, model_id: &str) -> String
A JS/WASM interface for Simulation.records
, which converts the
records to a YAML string.
sourcepub fn reset_messages(&mut self)
pub fn reset_messages(&mut self)
An interface to Simulation.reset_messages
.
sourcepub fn reset_global_time(&mut self)
pub fn reset_global_time(&mut self)
An interface to Simulation.reset_global_time
sourcepub fn inject_input_json(&mut self, message: &str)
pub fn inject_input_json(&mut self, message: &str)
A JS/WASM interface for Simulation.inject_input
, which uses a JSON
representation of the injected messages.
sourcepub fn inject_input_yaml(&mut self, message: &str)
pub fn inject_input_yaml(&mut self, message: &str)
A JS/WASM interface for Simulation.inject_input
, which uses a YAML
representation of the injected messages.
sourcepub fn step_js(&mut self) -> Array
pub fn step_js(&mut self) -> Array
A JS/WASM interface for Simulation.step
, which converts the
returned messages to a JavaScript Array.
sourcepub fn step_json(&mut self) -> String
pub fn step_json(&mut self) -> String
A JS/WASM interface for Simulation.step
, which converts the
returned messages to a JSON string.
sourcepub fn step_yaml(&mut self) -> String
pub fn step_yaml(&mut self) -> String
A JS/WASM interface for Simulation.step
, which converts the
returned messages to a YAML string.
sourcepub fn step_until_js(&mut self, until: f64) -> Array
pub fn step_until_js(&mut self, until: f64) -> Array
A JS/WASM interface for Simulation.step_until
, which converts the
returned messages to a JavaScript Array.
sourcepub fn step_until_json(&mut self, until: f64) -> String
pub fn step_until_json(&mut self, until: f64) -> String
A JS/WASM interface for Simulation.step_until
, which converts the
returned messages to a JSON string.
sourcepub fn step_until_yaml(&mut self, until: f64) -> String
pub fn step_until_yaml(&mut self, until: f64) -> String
A JS/WASM interface for Simulation.step_until
, which converts the
returned messages to a YAML string.
sourcepub fn step_n_js(&mut self, n: usize) -> Array
pub fn step_n_js(&mut self, n: usize) -> Array
A JS/WASM interface for Simulation.step_n
, which converts the
returned messages to a JavaScript Array.
sourcepub fn step_n_json(&mut self, n: usize) -> String
pub fn step_n_json(&mut self, n: usize) -> String
A JS/WASM interface for Simulation.step_n
, which converts the
returned messages to a JSON string.
sourcepub fn step_n_yaml(&mut self, n: usize) -> String
pub fn step_n_yaml(&mut self, n: usize) -> String
A JS/WASM interface for Simulation.step_n
, which converts the
returned messages to a YAML string.
Trait Implementations§
source§impl Default for Simulation
impl Default for Simulation
source§fn default() -> Simulation
fn default() -> 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>,
source§impl From<Simulation> for JsValue
impl From<Simulation> for JsValue
source§fn from(value: Simulation) -> Self
fn from(value: Simulation) -> Self
source§impl FromWasmAbi for Simulation
impl FromWasmAbi for Simulation
source§impl IntoWasmAbi for Simulation
impl IntoWasmAbi for Simulation
source§impl LongRefFromWasmAbi for Simulation
impl LongRefFromWasmAbi for Simulation
source§impl OptionFromWasmAbi for Simulation
impl OptionFromWasmAbi for Simulation
source§impl OptionIntoWasmAbi for Simulation
impl OptionIntoWasmAbi for Simulation
source§impl RefFromWasmAbi for Simulation
impl RefFromWasmAbi for Simulation
§type Anchor = Ref<'static, Simulation>
type Anchor = Ref<'static, Simulation>
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.source§impl RefMutFromWasmAbi for Simulation
impl RefMutFromWasmAbi for Simulation
source§impl Serialize for Simulation
impl Serialize for Simulation
source§impl TryFromJsValue for Simulation
impl TryFromJsValue for Simulation
source§impl VectorFromWasmAbi for Simulation
impl VectorFromWasmAbi for Simulation
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Simulation]>
source§impl VectorIntoWasmAbi for Simulation
impl VectorIntoWasmAbi for Simulation
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Simulation]>) -> Self::Abi
source§impl WasmDescribeVector for Simulation
impl WasmDescribeVector for Simulation
Auto Trait Implementations§
impl !RefUnwindSafe for Simulation
impl !Send for Simulation
impl !Sync for Simulation
impl Unpin 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
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.