Merge pull request #703 from dhardy/master
Disable std feature by default in rand_core and rand_jitter
diff --git a/rand_os/Cargo.toml b/rand_os/Cargo.toml
index 6673a76..92aa0f4 100644
--- a/rand_os/Cargo.toml
+++ b/rand_os/Cargo.toml
@@ -28,7 +28,7 @@
cloudabi = "0.0.3"
[target.'cfg(target_os = "fuchsia")'.dependencies]
-fuchsia-zircon = "0.3.2"
+fuchsia-cprng = "0.1.0"
[target.wasm32-unknown-unknown.dependencies]
wasm-bindgen = { version = "0.2.12", optional = true }
diff --git a/rand_os/src/fuchsia.rs b/rand_os/src/fuchsia.rs
index 7063ff6..ada3677 100644
--- a/rand_os/src/fuchsia.rs
+++ b/rand_os/src/fuchsia.rs
@@ -8,9 +8,9 @@
//! Implementation for Fuchsia Zircon
-extern crate fuchsia_zircon;
+extern crate fuchsia_cprng;
-use rand_core::{Error, ErrorKind};
+use rand_core::Error;
use super::OsRngImpl;
#[derive(Clone, Debug)]
@@ -20,24 +20,9 @@
fn new() -> Result<OsRng, Error> { Ok(OsRng) }
fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> {
- let mut read = 0;
- while read < dest.len() {
- match fuchsia_zircon::cprng_draw(&mut dest[read..]) {
- Ok(actual) => read += actual,
- Err(e) => {
- return Err(Error::with_cause(
- ErrorKind::Unavailable,
- "cprng_draw failed",
- e.into_io_error()));
- }
- };
- }
+ fuchsia_cprng::cprng_draw(dest);
Ok(())
}
- fn max_chunk_size(&self) -> usize {
- fuchsia_zircon::sys::ZX_CPRNG_DRAW_MAX_LEN
- }
-
fn method_str(&self) -> &'static str { "cprng_draw" }
}