Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

remove spawn from top-level #47

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions benches/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ macro_rules! benchmark_suite {

let tasks = (0..300)
.map(|_| {
runtime::spawn(async {
runtime::task::spawn(async {
Task { depth: 0 }.await;
})
})
Expand All @@ -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::<Vec<_>>();

for task in tasks {
Expand All @@ -61,15 +61,15 @@ 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();

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;
Expand Down
2 changes: 1 addition & 1 deletion examples/guessing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(())
}
})
Expand Down
2 changes: 1 addition & 1 deletion examples/tcp-echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion examples/tcp-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}",
Expand Down
2 changes: 1 addition & 1 deletion runtime-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion src/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?);
///
Expand Down
2 changes: 1 addition & 1 deletion src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// });
Expand Down
2 changes: 1 addition & 1 deletion tests/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down
2 changes: 1 addition & 1 deletion tests/tokio-current-thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down
2 changes: 1 addition & 1 deletion tests/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down