Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support moving a cell to a new ownership #19

Open
uazu opened this issue Aug 19, 2021 · 0 comments
Open

Support moving a cell to a new ownership #19

uazu opened this issue Aug 19, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@uazu
Copy link
Owner

uazu commented Aug 19, 2021

TLCell already supports a kind of transfer of ownership, but only between threads, due to there being an owner in each thread.

A QCell-like cell could potentially support transferring ownership since ownership is determined by the key value stored in the cell. However that key value is immutable. To make it mutable means either using an atomic type or else maybe by making the cell non-Sync and using a plain Cell to contain the key value.

The proposed address-based-key cell (issue #14) could also support transferring ownership to some other owner's address in a similar way, if there was an ID type that could be used to pass the other owner's address. (We don't need &mut on the second owner in order to transfer ownership to it, just the address.)

The other cells (TCell, TLCell and LCell) can't support transferring ownership because ownership is hardcoded at compile-time and is checked by the compiler, and so cannot be modified at runtime.

@uazu uazu added the enhancement New feature or request label Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant