Async programming in Rust is a recent development, only having been stabilized in Rust 1.39
. The async ecosystem is rapidly evolving, and SeaORM is one of the first crates built from the ground up with async support in mind.
The first thing to learn is the Future
trait. It's a placeholder for a function that will compute and return some value in the future. It's lazy, meaning .await
must be called for any actual work to be done. Future
allows us to achieve concurrency with little programming effort, e.g. future::join_all
to execute multiple queries in parallel.
Knowing these concepts is essential to get you up and running in async Rust.