Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to wasm-bindgen 0.2.12 #562

Merged
merged 1 commit into from Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -52,7 +52,7 @@ fuchsia-zircon = { version = "0.3.2", optional = true }
[target.wasm32-unknown-unknown.dependencies]
# use with `--target wasm32-unknown-unknown --features=stdweb`
stdweb = { version = "0.4", optional = true }
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen = { version = "0.2.12", optional = true }

[dev-dependencies]
# This is for testing serde, unfortunately we can't specify feature-gated dev
Expand Down
16 changes: 2 additions & 14 deletions src/lib.rs
Expand Up @@ -232,7 +232,6 @@
#![cfg_attr(feature = "stdweb", recursion_limit="128")]
#![cfg_attr(feature = "wasm-bindgen", feature(use_extern_macros))]
#![cfg_attr(feature = "wasm-bindgen", feature(wasm_import_module))]
#![cfg_attr(feature = "wasm-bindgen", feature(wasm_custom_section))]

#[cfg(feature="std")] extern crate std as core;
#[cfg(all(feature = "alloc", not(feature="std")))] extern crate alloc;
Expand Down Expand Up @@ -911,6 +910,7 @@ pub mod __wbg_shims {
#[wasm_bindgen(method, getter, structural)]
pub fn crypto(me: &This) -> JsValue;

#[derive(Clone, Debug)]
pub type BrowserCrypto;

// TODO: these `structural` annotations here ideally wouldn't be here to
Expand All @@ -924,24 +924,12 @@ pub mod __wbg_shims {
#[wasm_bindgen(js_name = require)]
pub fn node_require(s: &str) -> NodeCrypto;

#[derive(Clone, Debug)]
pub type NodeCrypto;

#[wasm_bindgen(method, js_name = randomFillSync, structural)]
pub fn random_fill_sync(me: &NodeCrypto, buf: &mut [u8]);
}

// TODO: replace with derive once rustwasm/wasm-bindgen#400 is merged
impl Clone for BrowserCrypto {
fn clone(&self) -> BrowserCrypto {
BrowserCrypto { obj: self.obj.clone() }
}
}

impl Clone for NodeCrypto {
fn clone(&self) -> NodeCrypto {
NodeCrypto { obj: self.obj.clone() }
}
}
}
}

Expand Down
11 changes: 1 addition & 10 deletions src/rngs/os.rs
Expand Up @@ -1107,14 +1107,12 @@ mod imp {
not(feature = "stdweb"),
feature = "wasm-bindgen"))]
mod imp {
use core::fmt;

use __wbg_shims::*;

use {Error, ErrorKind};
use super::OsRngImpl;

#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum OsRng {
Node(NodeCrypto),
Browser(BrowserCrypto),
Expand Down Expand Up @@ -1187,13 +1185,6 @@ mod imp {
}
}
}

// TODO: replace with derive once rustwasm/wasm-bindgen#399 is merged
impl fmt::Debug for OsRng {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("OsRng").finish()
}
}
}


Expand Down