2021-01-02 11:03:21 +00:00
|
|
|
// edition:2018
|
|
|
|
|
2021-01-14 06:15:04 +00:00
|
|
|
use std::{sync::Arc, future::Future, pin::Pin, task::{Context, Poll}};
|
2021-01-02 11:03:21 +00:00
|
|
|
|
|
|
|
async fn f() {
|
|
|
|
let room_ref = Arc::new(Vec::new());
|
|
|
|
|
|
|
|
let gameloop_handle = spawn(async { //~ ERROR E0373
|
|
|
|
game_loop(Arc::clone(&room_ref))
|
|
|
|
});
|
|
|
|
gameloop_handle.await;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn game_loop(v: Arc<Vec<usize>>) {}
|
|
|
|
|
|
|
|
fn spawn<F>(future: F) -> JoinHandle
|
|
|
|
where
|
|
|
|
F: Future + Send + 'static,
|
2021-01-02 16:53:50 +00:00
|
|
|
F::Output: Send + 'static,
|
2021-01-02 11:03:21 +00:00
|
|
|
{
|
|
|
|
loop {}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct JoinHandle;
|
|
|
|
|
|
|
|
impl Future for JoinHandle {
|
|
|
|
type Output = ();
|
|
|
|
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
2021-01-02 17:00:51 +00:00
|
|
|
loop {}
|
2021-01-02 11:03:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-02 16:53:50 +00:00
|
|
|
fn main() {}
|