From 292a040a0ca96796a7c02537aba384fa1f6743f5 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sun, 17 Oct 2021 20:53:48 -0700 Subject: [PATCH] Implement JsContainerFromValue for StructureObject --- src/enums.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/enums.rs b/src/enums.rs index 260c64d9..54b55338 100644 --- a/src/enums.rs +++ b/src/enums.rs @@ -3,6 +3,7 @@ use wasm_bindgen::{JsCast, JsValue}; use crate::objects::*; use crate::prelude::*; +use crate::JsContainerFromValue; #[enum_dispatch(Attackable)] pub enum AttackableObject { @@ -398,6 +399,12 @@ impl From for StructureObject { } } +impl JsContainerFromValue for StructureObject { + fn from_value(val: JsValue) -> Self { + Self::from(val) + } +} + impl From for StructureObject { fn from(structure: Structure) -> Self { use crate::constants::StructureType::*; @@ -611,4 +618,4 @@ impl StructureObject { Self::StructureInvaderCore(_) => None, } } -} \ No newline at end of file +}