mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add TokioTaskExecutor::boxed (#12619)
This commit is contained in:
@ -111,6 +111,13 @@ dyn_clone::clone_trait_object!(TaskSpawner);
|
||||
#[non_exhaustive]
|
||||
pub struct TokioTaskExecutor;
|
||||
|
||||
impl TokioTaskExecutor {
|
||||
/// Converts the instance to a boxed [`TaskSpawner`].
|
||||
pub fn boxed(self) -> Box<dyn TaskSpawner> {
|
||||
Box::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl TaskSpawner for TokioTaskExecutor {
|
||||
fn spawn(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()> {
|
||||
tokio::task::spawn(fut)
|
||||
|
||||
Reference in New Issue
Block a user