diff --git a/src/task/spawn.rs b/src/task/spawn.rs index f81a483d2..857d3f398 100644 --- a/src/task/spawn.rs +++ b/src/task/spawn.rs @@ -23,6 +23,30 @@ use crate::task::{Builder, JoinHandle}; /// # /// # }) /// ``` +/// +/// ```ignore +/// use async_std::task; +/// use std::time::Duration; +/// +/// async fn clock() { +/// loop { +/// task::sleep(Duration::from_secs(1)).await; +/// println!("Tick"); +/// } +///} +/// +/// #[async_std::main] +/// async fn main() { +/// println!("Start"); +/// task::spawn(clock()); +/// +/// for i in (0..=10).rev() { +/// println!("Countdown {}", i); +/// task::sleep(Duration::from_secs(2)).await; +/// } +/// println!("End"); +///} +/// ``` pub fn spawn(future: F) -> JoinHandle where F: Future + Send + 'static, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy