From 3f38ba99f7f57c242d6b3a8c592d6d9259e59a95 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 20 Mar 2022 23:53:57 +0800 Subject: [PATCH] feat: update mini tokio --- __concurrent/async_study/examples/mini_tokio.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/__concurrent/async_study/examples/mini_tokio.rs b/__concurrent/async_study/examples/mini_tokio.rs index c542fbf..608d915 100644 --- a/__concurrent/async_study/examples/mini_tokio.rs +++ b/__concurrent/async_study/examples/mini_tokio.rs @@ -35,10 +35,7 @@ impl MiniTokio { } /// Spawn a future onto the mini-tokio instance. - fn spawn(&mut self, future: F) - where - F: Future + Send + 'static, - { + fn spawn(&mut self, future: F) where F: Future + Send + 'static, { self.tasks.push_back(Box::pin(future)); } @@ -62,9 +59,7 @@ struct Delay { impl Future for Delay { type Output = &'static str; - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) - -> Poll<&'static str> - { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<&'static str> { if Instant::now() >= self.when { println!("Hello world"); Poll::Ready("done")