feat(d1): add IntoFuture and #[must_use] to D1PreparedStatement#1007
Conversation
A statement that never runs compiles fine but does nothing. Mark the type #[must_use] so that case is a compile warning, matching the KV builders.
|
For the For the |
Awaiting a prepared statement now runs it through run(), so callers can write `stmt.await?` instead of `stmt.run().await?`. Update the must_use note to mention await.
|
Added the |
Merging this PR will not alter performance
|
ajharhussain250-jpg
left a comment
There was a problem hiding this comment.
Hi i am a workr and i hop you cansider me on x twitter. best wishise for you. your freind Azher Hussain Khuwaja.
D1PreparedStatementholds a query that has not run yet. With no terminal call it compiles fine and does nothing, e.g.query!(&db, "DELETE FROM users WHERE id = ?", id)?;. Adding#[must_use]to the type makes that a compile warning, matching the KV builders (GetOptionsBuilder,PutOptionsBuilder).#774 also asks for
impl IntoFutureso a statement runs when you.awaitit. That would be the firstIntoFuturein the crate, andawait stmthas to pick one terminal method. I can follow up with one delegating torun()to match the JSstmt.run(), orall()if you'd prefer.Part of #774.