diff options
| author | Yuval Adam <_@yuv.al> | 2022-06-28 09:33:17 +0300 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2022-06-28 09:33:17 +0300 |
| commit | 7438c83aca7d5ba7eab7cafc3068207588c83ded (patch) | |
| tree | 56d9d1479bcc313716bbacef72b3f53c2b42c6af | |
| parent | f4f049df9f544e263eeb6e1f5bd3413eac0ae0c5 (diff) | |
Add rand call
| -rw-r--r-- | Cargo.lock | 66 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/main.rs | 15 |
3 files changed, 81 insertions, 1 deletions
@@ -3,6 +3,12 @@ version = 3 [[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] name = "futures" version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -92,6 +98,23 @@ dependencies = [ ] [[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -110,6 +133,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] name = "proc-macro2" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -128,10 +157,41 @@ dependencies = [ ] [[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] + +[[package]] name = "rust-async-playground" version = "0.1.0" dependencies = [ "futures", + "rand", ] [[package]] @@ -156,3 +216,9 @@ name = "unicode-ident" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" @@ -5,3 +5,4 @@ edition = "2021" [dependencies] futures = "0.3" +rand = "0.8" diff --git a/src/main.rs b/src/main.rs index 0e1f7bc..e1e8efd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,20 @@ use futures::executor::block_on; +use rand::prelude::*; + +trait SimpleFuture { + type Output; + fn poll(&mut self, wake: fn()) -> Poll<Self::Output>; +} + +enum Poll<T> { + Ready(T), + Pending, +} async fn hello_world() { - println!("hello, world!"); + let mut rng = rand::thread_rng(); + let y: f64 = rng.gen(); + println!("hello, world! {}", y); } fn main() { |
