use super::Scheduler;
use crate::{
disposable::{Disposable, bound_drop_disposal::BoundDropDisposal},
utils::types::MaybeSend,
};
use std::time::Duration;
#[derive(Debug, Clone)]
pub struct SmolScheduler;
impl Scheduler for SmolScheduler {
type D = smol::Task<()>;
fn spawn_future(
&self,
future: impl Future<Output = ()> + MaybeSend + 'static,
) -> BoundDropDisposal<Self::D> {
let handle = smol::spawn(future);
BoundDropDisposal::new(handle)
}
fn sleep(&self, duration: Duration) -> impl Future + MaybeSend + 'static + use<> {
smol::Timer::after(duration)
}
}
impl Disposable for smol::Task<()> {
fn dispose(self) {
}
}