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
sourceimpl 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
sourceimpl Default for Simulation
impl Default for Simulation
sourcefn default() -> Simulation
fn default() -> Simulation
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for Simulation
impl<'de> Deserialize<'de> for Simulation
sourcefn 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
sourceimpl From<Simulation> for JsValue
impl From<Simulation> for JsValue
sourcefn from(value: Simulation) -> Self
fn from(value: Simulation) -> Self
Converts to this type from the input type.
sourceimpl FromWasmAbi for Simulation
impl FromWasmAbi for Simulation
sourceimpl IntoWasmAbi for Simulation
impl IntoWasmAbi for Simulation
sourceimpl OptionFromWasmAbi for Simulation
impl OptionFromWasmAbi for Simulation
sourceimpl OptionIntoWasmAbi for Simulation
impl OptionIntoWasmAbi for Simulation
sourceimpl RefFromWasmAbi for Simulation
impl RefFromWasmAbi for Simulation
type Anchor = Ref<'static, Simulation>
type Anchor = Ref<'static, Simulation>
The type that holds the reference to 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. Read more
sourceunsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
Recover a Self::Anchor
from Self::Abi
. Read more
sourceimpl RefMutFromWasmAbi for Simulation
impl RefMutFromWasmAbi for Simulation
type Anchor = RefMut<'static, Simulation>
type Anchor = RefMut<'static, Simulation>
Same as RefFromWasmAbi::Anchor
sourceunsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as RefFromWasmAbi::ref_from_abi
sourceimpl Serialize for Simulation
impl Serialize for Simulation
sourceimpl WasmDescribe for Simulation
impl WasmDescribe 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
sourcefn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
. Read more