serenity 0.12.5

A Rust library for the Discord API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[cfg(feature = "http")]
use std::future::Future;

#[cfg(feature = "http")]
pub fn spawn_named<F, T>(_name: &str, future: F) -> tokio::task::JoinHandle<T>
where
    F: Future<Output = T> + Send + 'static,
    T: Send + 'static,
{
    #[cfg(all(tokio_unstable, feature = "tokio_task_builder"))]
    let handle = tokio::task::Builder::new()
        .name(&*format!("serenity::{}", _name))
        .spawn(future)
        .expect("called outside tokio runtime");
    #[cfg(not(all(tokio_unstable, feature = "tokio_task_builder")))]
    let handle = tokio::spawn(future);
    handle
}