Open
Description
It would be nice to await
builders directly.
There's a nice explanation of this pattern here - https://blog.yoshuawuyts.com/async-finalizers/
it will allow us to rewrite this-
let index = Index::init(root, download)
.build()
.await?;
like this-
let index = Index::init(root, download)
.await?;
There are two options for doing this
- implement
Future
for the builders. This isn't too hard, but it's not that clean, and makes the code look a little unapproachable. - implement
IntoFuture
for the builders. This relies on an unmerged nightly feature, and has been stuck in limbo for a while - Re-land "add IntoFuture trait and support for await" rust-lang/rust#68811