Skip to content

Conversation

rozbb
Copy link
Contributor

@rozbb rozbb commented Mar 4, 2025

Currently, durable::Storage::transaction requires that its closure implement Copy. This is way too strong a requirement, since you can't even do things like:

let key: String = get_dur_obj_key();
storage.transaction(move |tx| async move {
    let val = tx.get(&key).await?;
});

The compiler yells, saying the trait bound String: std::marker::Copy is not satisfied in {closure@...}.

Fortunately, there's no inherent reason why this closure needs to implement Copy. This PR changes the transaction semantics to make use of wasm_bindgen's built-in FnOnce support for futures.

zebp
zebp previously approved these changes Mar 4, 2025
guybedford
guybedford previously approved these changes Jun 17, 2025
@guybedford guybedford merged commit c7fde6e into cloudflare:main Jun 17, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants