Skip to content

Commit

Permalink
Rearrange module files
Browse files Browse the repository at this point in the history
  • Loading branch information
flosse committed Mar 7, 2023
1 parent 4b0f1f8 commit f0fdb70
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 56 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 0 additions & 12 deletions src/browser/json.rs

This file was deleted.

17 changes: 17 additions & 0 deletions src/browser/json/mod.rs
@@ -0,0 +1,17 @@
use serde::{de::DeserializeOwned, Serialize};
use serde_wasm_bindgen as swb;
use wasm_bindgen::JsValue;

pub fn from_js_value<T>(v: &JsValue) -> Result<T, JsValue>
where
T: DeserializeOwned,
{
Ok(swb::from_value(v.into())?)
}

pub fn to_js_value<T>(v: &T) -> Result<JsValue, JsValue>
where
T: Serialize + ?Sized,
{
Ok(v.serialize(&swb::Serializer::json_compatible())?)
}
21 changes: 0 additions & 21 deletions src/browser/json/serde_json.rs

This file was deleted.

23 changes: 0 additions & 23 deletions src/browser/json/swb.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f0fdb70

Please sign in to comment.