Use serde to serialize responses (#96)

This commit is contained in:
TrueDoctor
2021-05-07 02:47:38 -07:00
committed by Keavon Chambers
parent 9ad5f4ce78
commit 721a442b75
13 changed files with 99 additions and 45 deletions
+11
View File
@@ -2,6 +2,8 @@ use crate::shims::Error;
use editor_core::events;
use editor_core::tools::{SelectAppendMode, ToolType};
use editor_core::Color as InnerColor;
use events::Response;
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
@@ -24,6 +26,15 @@ impl Color {
}
}
#[derive(Serialize, Deserialize)]
pub struct WasmResponse(Response);
impl WasmResponse {
pub fn new(response: Response) -> Self {
Self(response)
}
}
macro_rules! match_string_to_enum {
(match ($e:expr) {$($var:ident),* $(,)?}) => {
match $e {