- Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Async closure has been stabilized in Rust 1.85 this brings a much better ergonomic when passing reference to a closure.
For instance currently this wrapper is not possible (but would be fine if TransactionBuilder::run
would accept an async closure):
struct WrapperDatabase { pub async fn for_update<R, E>( &mut self, cb: impl AsyncFnOnce(TransactionWrapper), ) { self.conn.transaction(&["store"]) .run(async move |transaction| { let wrapper = TransactionWrapper(transaction); cb(wrapper).await Ok(()) }) .await.unwrap(); } }
Rust compilation error:
the parameter type `impl AsyncFnOnce(TransactionWrapper)` must be valid for the static lifetime... ...so that the type `impl AsyncFnOnce(TransactionWrapper)` will meet its required lifetime bounds
Metadata
Metadata
Assignees
Labels
No labels