Struct wasm_wrapper::WasmWrapper
source · pub struct WasmWrapper {
pub(crate) p: Pendulum,
pub(crate) trajs: Vec<[f64; 2]>,
pub(crate) enes: [Vec<f64>; 2],
pub(crate) drawer: Drawer,
}
Expand description
Wrapper of objects containing states
Fields§
§p: Pendulum
Pendulum, nothing else.
trajs: Vec<[f64; 2]>
History of the last mass point in Cartesian coordinate.
enes: [Vec<f64>; 2]
History of the kinetic and the potential energies.
drawer: Drawer
Handles drawing, keeping HTML objects.
Implementations§
source§impl WasmWrapper
impl WasmWrapper
Serves as an opaque pointer to store all states.
sourcepub fn new(nitems: usize) -> WasmWrapper
pub fn new(nitems: usize) -> WasmWrapper
Initialiser.
sourcepub fn update_canvas_size(&self)
pub fn update_canvas_size(&self)
Changes canvas size, invoked by the resize
event.
Trait Implementations§
source§impl From<WasmWrapper> for JsValue
impl From<WasmWrapper> for JsValue
source§fn from(value: WasmWrapper) -> Self
fn from(value: WasmWrapper) -> Self
Converts to this type from the input type.
source§impl FromWasmAbi for WasmWrapper
impl FromWasmAbi for WasmWrapper
source§impl IntoWasmAbi for WasmWrapper
impl IntoWasmAbi for WasmWrapper
source§impl LongRefFromWasmAbi for WasmWrapper
impl LongRefFromWasmAbi for WasmWrapper
source§impl OptionFromWasmAbi for WasmWrapper
impl OptionFromWasmAbi for WasmWrapper
source§impl OptionIntoWasmAbi for WasmWrapper
impl OptionIntoWasmAbi for WasmWrapper
source§impl RefFromWasmAbi for WasmWrapper
impl RefFromWasmAbi for WasmWrapper
§type Anchor = Ref<'static, WasmWrapper>
type Anchor = Ref<'static, WasmWrapper>
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.source§impl RefMutFromWasmAbi for WasmWrapper
impl RefMutFromWasmAbi for WasmWrapper
source§impl TryFromJsValue for WasmWrapper
impl TryFromJsValue for WasmWrapper
source§impl VectorFromWasmAbi for WasmWrapper
impl VectorFromWasmAbi for WasmWrapper
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WasmWrapper]>
source§impl VectorIntoWasmAbi for WasmWrapper
impl VectorIntoWasmAbi for WasmWrapper
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WasmWrapper]>) -> Self::Abi
source§impl WasmDescribe for WasmWrapper
impl WasmDescribe for WasmWrapper
source§impl WasmDescribeVector for WasmWrapper
impl WasmDescribeVector for WasmWrapper
Auto Trait Implementations§
impl RefUnwindSafe for WasmWrapper
impl !Send for WasmWrapper
impl !Sync for WasmWrapper
impl Unpin for WasmWrapper
impl UnwindSafe for WasmWrapper
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<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
Same as
IntoWasmAbi::Abi
source§fn 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
.