bytecodealliance / bytecodealliance/wit-bindgen

Should `Handle<T>` implement `DerefMut<T> where T: LocalHandle`?

Open
#31 2 comments 1 reaction 0 assignees View on GitHub
gen-rust
Dominant language
Rust
Stars
1.5k
Forks
286
Avg merge
6h 32m
Merged PRs (30d)
19

Description

I can envision uses cases where there are "setter" functions on a resource:

```witx
resource person {
get_name: function() -> string
set_name: function(name: string)
}

new_person: function(name: string) -> person
```

Right now the implementer of this interface can't get a mutable reference to the underlying `T` as `Handle` doesn't implement `DerefMut`.

Thoughts on implementing it and its safety guarantee (should we wrap the underlying resource with a `RefCell` to at least get runtime borrow-checking)?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.