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

Unique #6

Open
Tamschi opened this issue Nov 7, 2021 · 0 comments
Open

Unique #6

Tamschi opened this issue Nov 7, 2021 · 0 comments
Labels
domain: Rust Involves Rust code. good first issue Good for newcomers priority: someday If you need this, please let me know! state: approved Approved to proceed. type: feature Brand new functionality, features, pages, workflows, endpoints, etc. work: clear A known solution is (to be) implemented.

Comments

@Tamschi
Copy link
Owner

Tamschi commented Nov 7, 2021

Is your feature request related to a problem? Please describe.

It's fairly likely that situation will appear where a guaranteed-unique but still reference-counted smart pointer type would be helpful.

For example, this type could allow mutable access to its managed instance at no overhead, and then could be converted into an Arc or Rc again with no overhead.
It would also be useful as common hub to convert between smart pointer types, since any smart pointer with reference count 1 and matching encapsulation and RefCounter in this crate should be directly compatible.

Describe the solution you'd like

The new Unique<T> should behave exactly like Arc<T>, with the caveat that it can't be cloned without converting it to the latter first. If Rc<T> is already implemented, it should also be convertible to and from that.

(The latter conversion should probably use TryFrom.)

There should also be infallible Box<T> conversions to and from Unique<T> that do adjust the reference count.

Describe alternatives you've considered

None.

Additional context

None.

@Tamschi Tamschi added type: feature Brand new functionality, features, pages, workflows, endpoints, etc. good first issue Good for newcomers priority: someday If you need this, please let me know! state: approved Approved to proceed. work: clear A known solution is (to be) implemented. domain: Rust Involves Rust code. labels Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: Rust Involves Rust code. good first issue Good for newcomers priority: someday If you need this, please let me know! state: approved Approved to proceed. type: feature Brand new functionality, features, pages, workflows, endpoints, etc. work: clear A known solution is (to be) implemented.
Projects
None yet
Development

No branches or pull requests

1 participant