feat: update mini tokio

This commit is contained in:
2022-03-20 23:53:57 +08:00
parent 18b7b4707a
commit 3f38ba99f7

View File

@@ -35,10 +35,7 @@ impl MiniTokio {
}
/// Spawn a future onto the mini-tokio instance.
fn spawn<F>(&mut self, future: F)
where
F: Future<Output=()> + Send + 'static,
{
fn spawn<F>(&mut self, future: F) where F: Future<Output=()> + 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")