| 1 | #![feature(test)] |
| 2 | #![allow(deprecated)] |
| 3 | |
| 4 | use futures_literust-analyzer cargo futures-lite 1.13.0 crate/::futurerust-analyzer cargo futures-lite 1.13.0 future/::block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().; |
| 5 | use futures_microrust-analyzer cargo futures-micro 1.0.0-rc0 crate/::{poll_fnrust-analyzer cargo futures-micro 1.0.0-rc0 poll_fn()., preluderust-analyzer cargo futures-micro 1.0.0-rc0 prelude/::*}; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::taskrust-analyzer cargo std https://github.com/rust-lang/rust/library/std task/::Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#; |
| 7 | |
| 8 | fn readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().<T>(x: T) -> impl Futurerust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#Output# = T> { |
| 9 | let mut x = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x); |
| 10 | poll_fnrust-analyzer cargo futures-micro 1.0.0-rc0 poll_fn().(move |_| Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(x.takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 11 | } |
| 12 | |
| 13 | fn pendingrust-analyzer cargo futures-micro 1.0.0-rc0 pending().<T>() -> impl Futurerust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#Output# = T> { |
| 14 | poll_fnrust-analyzer cargo futures-micro 1.0.0-rc0 poll_fn().(|_| Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Pendingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Pending#) |
| 15 | } |
| 16 | |
| 17 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 18 | fn waker_sleep_testrust-analyzer cargo futures-micro 1.0.0-rc0 waker_sleep_test().() { |
| 19 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(async { |
| 20 | let waker = wakerrust-analyzer cargo futures-micro 1.0.0-rc0 waker().().rust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().awaitrust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().; |
| 21 | waker.wakerust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/impl#[Waker]wake().(); |
| 22 | sleeprust-analyzer cargo futures-micro 1.0.0-rc0 sleep().().rust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().awaitrust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().; |
| 23 | true |
| 24 | })); |
| 25 | } |
| 26 | |
| 27 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 28 | fn yield_once_testrust-analyzer cargo futures-micro 1.0.0-rc0 yield_once_test().() { |
| 29 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 30 | true, |
| 31 | block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(async { |
| 32 | yield_oncerust-analyzer cargo futures-micro 1.0.0-rc0 yield_once().().rust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().awaitrust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().; |
| 33 | true |
| 34 | }) |
| 35 | ); |
| 36 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 37 | false, |
| 38 | block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(orrust-analyzer cargo futures-micro 1.0.0-rc0 or!!( |
| 39 | async { |
| 40 | yield_oncerust-analyzer cargo futures-micro 1.0.0-rc0 yield_once().().rust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().awaitrust-analyzer cargo futures-micro 1.0.0-rc0 impl#[`PollFn<F>`][Future]poll().; |
| 41 | true |
| 42 | }, |
| 43 | readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(false) |
| 44 | )) |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 49 | fn or_testrust-analyzer cargo futures-micro 1.0.0-rc0 or_test().() { |
| 50 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(false, block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(orrust-analyzer cargo futures-micro 1.0.0-rc0 prelude/or().(pendingrust-analyzer cargo futures-micro 1.0.0-rc0 pending().::<bool>(), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(false)))); |
| 51 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1, block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(orrust-analyzer cargo futures-micro 1.0.0-rc0 or!!(readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(1), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(2), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(3)))); |
| 52 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(2, block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(orrust-analyzer cargo futures-micro 1.0.0-rc0 or!!(pendingrust-analyzer cargo futures-micro 1.0.0-rc0 pending().(), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(2), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(3)))); |
| 53 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(3, block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(orrust-analyzer cargo futures-micro 1.0.0-rc0 or!!(pendingrust-analyzer cargo futures-micro 1.0.0-rc0 pending().(), pendingrust-analyzer cargo futures-micro 1.0.0-rc0 pending().(), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(3)))); |
| 54 | } |
| 55 | |
| 56 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 57 | fn zip_testrust-analyzer cargo futures-micro 1.0.0-rc0 zip_test().() { |
| 58 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((true, false), block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(ziprust-analyzer cargo futures-micro 1.0.0-rc0 prelude/zip().(readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(true), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(false)))); |
| 59 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((1, 2, 3), block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(ziprust-analyzer cargo futures-micro 1.0.0-rc0 zip!!(readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(1), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(2), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(3)))); |
| 60 | |
| 61 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 62 | (1, false, 3), |
| 63 | block_onrust-analyzer cargo futures-lite 1.13.0 future/block_on().(ziprust-analyzer cargo futures-micro 1.0.0-rc0 zip!!(readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(1), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(false), readyrust-analyzer cargo futures-micro 1.0.0-rc0 ready().(3))) |
| 64 | ); |
| 65 | } |