diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-02-26 01:58:00 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-02-26 01:58:00 +0100 |
| commit | 17cf301d4fdc3bc0b1356ed250bfacca0d67ef3e (patch) | |
| tree | af8f914473df09e19651660a79e19aa06e201419 /embassy-std | |
| parent | 11be9170ec018dcc9284b413c5313ce7bb07159f (diff) | |
Remove rand(), fixes #50
Diffstat (limited to 'embassy-std')
| -rw-r--r-- | embassy-std/Cargo.toml | 3 | ||||
| -rw-r--r-- | embassy-std/src/lib.rs | 9 |
2 files changed, 1 insertions, 11 deletions
diff --git a/embassy-std/Cargo.toml b/embassy-std/Cargo.toml index 2a8028137..0a59999c0 100644 --- a/embassy-std/Cargo.toml +++ b/embassy-std/Cargo.toml | |||
| @@ -6,5 +6,4 @@ edition = "2018" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy = { version = "0.1.0", path = "../embassy", features = ["std"] } | 8 | embassy = { version = "0.1.0", path = "../embassy", features = ["std"] } |
| 9 | lazy_static = "1.4.0" | 9 | lazy_static = "1.4.0" \ No newline at end of file |
| 10 | rand_core = { version = "0.6.0", features = ["std"] } | ||
diff --git a/embassy-std/src/lib.rs b/embassy-std/src/lib.rs index 29f4de421..688054cb9 100644 --- a/embassy-std/src/lib.rs +++ b/embassy-std/src/lib.rs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | use embassy::executor::{raw, Spawner}; | 1 | use embassy::executor::{raw, Spawner}; |
| 2 | use embassy::time::TICKS_PER_SECOND; | 2 | use embassy::time::TICKS_PER_SECOND; |
| 3 | use embassy::time::{Alarm, Clock}; | 3 | use embassy::time::{Alarm, Clock}; |
| 4 | use rand_core::{OsRng, RngCore}; | ||
| 5 | use std::marker::PhantomData; | 4 | use std::marker::PhantomData; |
| 6 | use std::mem::MaybeUninit; | 5 | use std::mem::MaybeUninit; |
| 7 | use std::ptr; | 6 | use std::ptr; |
| @@ -19,13 +18,6 @@ impl Clock for StdClock { | |||
| 19 | } | 18 | } |
| 20 | } | 19 | } |
| 21 | 20 | ||
| 22 | struct StdRand; | ||
| 23 | impl embassy::rand::Rand for StdRand { | ||
| 24 | fn rand(&self, buf: &mut [u8]) { | ||
| 25 | OsRng.fill_bytes(buf); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 29 | static mut ALARM_AT: u64 = u64::MAX; | 21 | static mut ALARM_AT: u64 = u64::MAX; |
| 30 | 22 | ||
| 31 | pub struct StdAlarm; | 23 | pub struct StdAlarm; |
| @@ -101,7 +93,6 @@ impl Executor { | |||
| 101 | unsafe { | 93 | unsafe { |
| 102 | CLOCK_ZERO.as_mut_ptr().write(StdInstant::now()); | 94 | CLOCK_ZERO.as_mut_ptr().write(StdInstant::now()); |
| 103 | embassy::time::set_clock(&StdClock); | 95 | embassy::time::set_clock(&StdClock); |
| 104 | embassy::rand::set_rand(&StdRand); | ||
| 105 | } | 96 | } |
| 106 | 97 | ||
| 107 | Self { | 98 | Self { |
