1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Tokio global executor runtime.

use crate::core::Runtime;
use std::future::Future;

/// Spawns tasks on global tokio executor.
#[derive(Debug, Clone, Copy)]
pub struct TokioGlobal;

impl Runtime for TokioGlobal {
    fn spawn<F>(&self, future: F)
    where
        F: Future<Output = ()> + Send + 'static,
    {
        tokio::spawn(future);
    }
}

impl Default for TokioGlobal {
    #[must_use]
    fn default() -> Self {
        Self
    }
}