What is a Future in Rust

A Future in Rust is a placeholder for a computation that will complete later, enabling non-blocking asynchronous code.

A Future in Rust is a placeholder for a value that will be available later, representing a computation that hasn't finished yet. You create one by using the async keyword on a function or block, which returns a Future that must be polled by an executor to complete.

use std::future::Future;

async fn fetch_data() -> String {
    "data".to_string()
}

fn main() {
    let future: impl Future<Output = String> = fetch_data();
}