Could not find 'time' in 'tokio' (0.2.10)

im reading the doc:

but cannot compile the example,

    se tokio::time::delay_for; //could not find `time` in `tokio

    use std::time::Duration;


    #[tokio::main]
    async fn main() {
        delay_for(Duration::from_millis(100)).await;
        println!("100 ms have elapsed");
    }

it said
could not find 'time' in 'tokio'

We can't help much without your own code.

The docs say it requires the "time" feature -- do you have that enabled in your Cargo.toml?

thanks,i should add
tokio = { version = "0.2.11", features = ["full"] } in toml

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.