Skip to content

Commit

Permalink
Implement JsContainerFromValue for StructureObject
Browse files Browse the repository at this point in the history
  • Loading branch information
smessmer committed Oct 18, 2021
1 parent 8f8281c commit 292a040
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use wasm_bindgen::{JsCast, JsValue};

use crate::objects::*;
use crate::prelude::*;
use crate::JsContainerFromValue;

#[enum_dispatch(Attackable)]
pub enum AttackableObject {
Expand Down Expand Up @@ -398,6 +399,12 @@ impl From<JsValue> for StructureObject {
}
}

impl JsContainerFromValue for StructureObject {
fn from_value(val: JsValue) -> Self {
Self::from(val)
}
}

impl From<Structure> for StructureObject {
fn from(structure: Structure) -> Self {
use crate::constants::StructureType::*;
Expand Down Expand Up @@ -611,4 +618,4 @@ impl StructureObject {
Self::StructureInvaderCore(_) => None,
}
}
}
}

0 comments on commit 292a040

Please sign in to comment.