-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
17 additions
and
56 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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())?) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.