tina-core 0.0.2

Tina platform
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Application扩展
use crate::tina::data::AppResult;
use crate::tina::server::application::{Application, ApplicationExt};
use std::future::Future;
use std::time::Duration;
use tokio::time::sleep;

#[crate::async_trait]
impl ApplicationExt for Application {
    async fn sleep_current_task(&self, duration: Duration) {
        sleep(duration).await;
    }

    fn spawn<F: Future<Output = AppResult<R>> + Send + 'static, R: Send + 'static>(&self, fut: F) -> AppResult<()> {
        tokio::spawn(fut);
        Ok(())
    }
}