diff --git a/benches/common/mod.rs b/benches/common/mod.rs index a8c136fd..705b5b59 100644 --- a/benches/common/mod.rs +++ b/benches/common/mod.rs @@ -30,7 +30,7 @@ macro_rules! benchmark_suite { let tasks = (0..300) .map(|_| { - runtime::spawn(async { + runtime::task::spawn(async { Task { depth: 0 }.await; }) }) @@ -44,7 +44,7 @@ macro_rules! benchmark_suite { #[runtime::bench($rt)] async fn spawn_many() { let tasks = (0..25_000) - .map(|_| runtime::spawn(async {})) + .map(|_| runtime::task::spawn(async {})) .collect::>(); for task in tasks { @@ -61,7 +61,7 @@ macro_rules! benchmark_suite { let tasks = (0..300) .map(|_| { - runtime::spawn(async { + runtime::task::spawn(async { let (r, s) = mio::Registration::new2(); let registration = Registration::new(); registration.register(&r).unwrap(); @@ -69,7 +69,7 @@ macro_rules! benchmark_suite { let mut depth = 0; let mut capture = Some(r); - runtime::spawn( + runtime::task::spawn( Compat01As03::new(future::poll_fn(move || loop { if registration.poll_read_ready().unwrap().is_ready() { depth += 1; diff --git a/examples/guessing.rs b/examples/guessing.rs index 4471eb8b..c3fd1fcf 100644 --- a/examples/guessing.rs +++ b/examples/guessing.rs @@ -65,7 +65,7 @@ async fn main() -> Result<(), failure::Error> { incoming .try_for_each_concurrent(None, |stream| { async move { - runtime::spawn(play(stream)).await?; + runtime::task::spawn(play(stream)).await?; Ok::<(), failure::Error>(()) } }) diff --git a/examples/tcp-echo.rs b/examples/tcp-echo.rs index ac15ee51..dde3442f 100644 --- a/examples/tcp-echo.rs +++ b/examples/tcp-echo.rs @@ -18,7 +18,7 @@ async fn main() -> std::io::Result<()> { .incoming() .try_for_each_concurrent(None, |stream| { async move { - runtime::spawn(async move { + runtime::task::spawn(async move { println!("Accepting from: {}", stream.peer_addr()?); let (reader, writer) = &mut stream.split(); diff --git a/examples/tcp-proxy.rs b/examples/tcp-proxy.rs index c2f67306..0690227d 100644 --- a/examples/tcp-proxy.rs +++ b/examples/tcp-proxy.rs @@ -16,7 +16,7 @@ async fn main() -> std::io::Result<()> { .incoming() .try_for_each_concurrent(None, |client| { async move { - runtime::spawn(async move { + runtime::task::spawn(async move { let server = TcpStream::connect("127.0.0.1:8080").await?; println!( "Proxying {} to {}", diff --git a/runtime-attributes/src/lib.rs b/runtime-attributes/src/lib.rs index a6cbb0a4..734bb3e8 100644 --- a/runtime-attributes/src/lib.rs +++ b/runtime-attributes/src/lib.rs @@ -140,7 +140,7 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream { /// /// #[runtime::test] /// async fn spawn_and_await() { -/// runtime::spawn(async {}).await; +/// runtime::task::spawn(async {}).await; /// } /// ``` #[proc_macro_attribute] diff --git a/src/lib.rs b/src/lib.rs index 02ea90db..9060700c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,9 +120,6 @@ pub mod prelude { pub use super::time::StreamExt as _; } -#[doc(inline)] -pub use task::spawn; - #[doc(inline)] pub use runtime_attributes::{bench, test}; diff --git a/src/net/tcp.rs b/src/net/tcp.rs index fd7721e2..7b2e3257 100644 --- a/src/net/tcp.rs +++ b/src/net/tcp.rs @@ -304,7 +304,7 @@ impl fmt::Debug for ConnectFuture { /// // accept connections and process them in parallel /// let mut incoming = listener.incoming(); /// while let Some(stream) = incoming.next().await { -/// runtime::spawn(async move { +/// runtime::task::spawn(async move { /// let stream = stream?; /// println!("Accepting from: {}", stream.peer_addr()?); /// diff --git a/src/task.rs b/src/task.rs index c30ad55b..e27c3924 100644 --- a/src/task.rs +++ b/src/task.rs @@ -56,7 +56,7 @@ impl<'a> Spawn for &'a Spawner { /// /// #[runtime::main] /// async fn main() { -/// let handle = runtime::spawn(async { +/// let handle = runtime::task::spawn(async { /// println!("running the future"); /// 42 /// }); diff --git a/tests/native.rs b/tests/native.rs index 7b5a0f20..c4c4d404 100644 --- a/tests/native.rs +++ b/tests/native.rs @@ -4,7 +4,7 @@ use runtime_native::Native; #[runtime::test(Native)] async fn spawn() { - let handle = runtime::spawn(async { + let handle = runtime::task::spawn(async { println!("hello planet from Native"); 42 }); diff --git a/tests/tokio-current-thread.rs b/tests/tokio-current-thread.rs index ab70c36f..8edb0ede 100644 --- a/tests/tokio-current-thread.rs +++ b/tests/tokio-current-thread.rs @@ -2,7 +2,7 @@ #[runtime::test(runtime_tokio::TokioCurrentThread)] async fn spawn() { - let handle = runtime::spawn(async { + let handle = runtime::task::spawn(async { println!("hello planet from Tokio current-thread"); 42 }); diff --git a/tests/tokio.rs b/tests/tokio.rs index 6fb605c2..2dcbb62f 100644 --- a/tests/tokio.rs +++ b/tests/tokio.rs @@ -4,7 +4,7 @@ use runtime_tokio::Tokio; #[runtime::test(Tokio)] async fn spawn() { - let handle = runtime::spawn(async { + let handle = runtime::task::spawn(async { println!("hello planet from Tokio"); 42 });