feat: update mini tokio
This commit is contained in:
@@ -35,10 +35,7 @@ impl MiniTokio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Spawn a future onto the mini-tokio instance.
|
/// Spawn a future onto the mini-tokio instance.
|
||||||
fn spawn<F>(&mut self, future: F)
|
fn spawn<F>(&mut self, future: F) where F: Future<Output=()> + Send + 'static, {
|
||||||
where
|
|
||||||
F: Future<Output=()> + Send + 'static,
|
|
||||||
{
|
|
||||||
self.tasks.push_back(Box::pin(future));
|
self.tasks.push_back(Box::pin(future));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,9 +59,7 @@ struct Delay {
|
|||||||
impl Future for Delay {
|
impl Future for Delay {
|
||||||
type Output = &'static str;
|
type Output = &'static str;
|
||||||
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>)
|
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<&'static str> {
|
||||||
-> Poll<&'static str>
|
|
||||||
{
|
|
||||||
if Instant::now() >= self.when {
|
if Instant::now() >= self.when {
|
||||||
println!("Hello world");
|
println!("Hello world");
|
||||||
Poll::Ready("done")
|
Poll::Ready("done")
|
||||||
|
|||||||
Reference in New Issue
Block a user