Use serde to serialize responses (#96)

This commit is contained in:
TrueDoctor
2021-05-02 22:46:47 +02:00
committed by Keavon Chambers
parent f10a3c63d1
commit f8ebff033d
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 {