mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 15:24:47 +00:00
Async await does not require a feature gate anymore!
This commit is contained in:
parent
8698321a2f
commit
a3a789521c
@ -15,7 +15,6 @@
|
||||
//!
|
||||
//! [`hello_world`]: https://github.com/tokio-rs/tokio/blob/132e9f1da5965530b63554d7a1c59824c3de4e30/tokio/examples/hello_world.rs
|
||||
#![deny(rust_2018_idioms)]
|
||||
#![feature(async_await)]
|
||||
|
||||
use tokio;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
@ -21,7 +21,6 @@
|
||||
//!
|
||||
//! [echo-example]: https://github.com/tokio-rs/tokio/blob/master/tokio/examples/echo.rs
|
||||
|
||||
#![feature(async_await)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
use futures::future::{FutureExt, TryFutureExt};
|
||||
@ -33,7 +32,7 @@ use std::env;
|
||||
use std::error::Error;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use tracing::{debug, error, info, info_span, instrument, trace, trace_span, warn};
|
||||
use tracing::{debug, info, info_span, trace_span, warn};
|
||||
use tracing_futures::Instrument;
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(async_await)]
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
//! A proxy that forwards data to another server and forwards that server's
|
||||
@ -23,7 +22,7 @@
|
||||
//! This final terminal will connect to our proxy, which will in turn connect to
|
||||
//! the echo server, and you'll be able to see data flowing between them.
|
||||
|
||||
use futures::{future::try_join, FutureExt, TryFutureExt};
|
||||
use futures::{future::try_join, TryFutureExt};
|
||||
use tokio::{
|
||||
self,
|
||||
io::AsyncReadExt,
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![feature(async_await)]
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
/// This is a example showing how information is scoped.
|
||||
@ -27,7 +26,7 @@ async fn parent_task(subtasks: usize) {
|
||||
let result = join_all(subtasks).await;
|
||||
|
||||
debug!("all subtasks completed");
|
||||
let sum = result.into_iter().sum();
|
||||
let sum: usize = result.into_iter().sum();
|
||||
info!(sum);
|
||||
}
|
||||
|
||||
@ -42,7 +41,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let subscriber = tracing_fmt::FmtSubscriber::builder()
|
||||
.with_filter("trace".parse::<tracing_fmt::filter::EnvFilter>()?)
|
||||
.finish();
|
||||
tracing::subscriber::set_global_default(subscriber);
|
||||
tracing::subscriber::set_global_default(subscriber)?;
|
||||
parent_task(10).await;
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user