19 lines
507 B
Rust
19 lines
507 B
Rust
use serde::{Deserialize, Serialize};
|
|
use serde_wasm_bindgen::*;
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
#[derive(Serialize, Deserialize, Clone)]
|
|
pub struct Champion {
|
|
pub name: String,
|
|
pub location: String,
|
|
}
|
|
|
|
#[wasm_bindgen(module = "/public/glue.js")]
|
|
extern "C" {
|
|
#[wasm_bindgen(js_name = load_champions_js, catch)]
|
|
pub async fn load_champions_js() -> Result<JsValue, JsValue>;
|
|
}
|
|
|
|
pub async fn load_champions() -> Result<Vec<Champion>, Error> {
|
|
from_value(load_champions_js().await.unwrap())
|
|
} |