Skip to content

Ensure FutureWriter always writes #1304

@alexcrichton

Description

@alexcrichton

Discussed some time ago, forgotten, and then reminded today, the expectation is that at the component model level dropping a writable-end future will be a trap if nothing was actually written. Modeling this in Rust without actually surfacing traps will be done with a few changes:

  • When a FutureWriter<T> is constructed an additional parameter default: fn() -> T will be required. This will be stored within the FutureWriter<T> return value.
  • When a FutureWriter<T> is dropped without recording a successful write then a task will be spawned which actually performs the write (e.g. calls the default and then performs the write for you).

This needs to be implemented in the Rust bindings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    asyncRelated to async/streams in the component model.gen-rustRelated to bindings for Rust-compiled-to-WebAssembly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions