use serde_wasm_bindgen::Error; use wasm_bindgen::JsValue; use wasm_bindgen::prelude::wasm_bindgen; use crate::game::Game; #[wasm_bindgen] pub struct GameWasm(Game); #[wasm_bindgen] impl GameWasm { #[wasm_bindgen(constructor)] pub fn new(seed: u64) -> GameWasm { GameWasm(Game::new(seed)) } pub fn get_tray(&self) -> Result { let tray = self.0.get_tray(); serde_wasm_bindgen::to_value(tray) } }