-
-
Notifications
You must be signed in to change notification settings - Fork 0
Unique #6
Copy link
Copy link
Open
Labels
domain: RustInvolves Rust code.Involves Rust code.good first issueGood for newcomersGood for newcomerspriority: somedayIf you need this, please let me know!If you need this, please let me know!state: approvedApproved to proceed.Approved to proceed.type: featureBrand new functionality, features, pages, workflows, endpoints, etc.Brand new functionality, features, pages, workflows, endpoints, etc.work: clearA known solution is (to be) implemented.A known solution is (to be) implemented.
Description
Activity
Metadata
Metadata
Assignees
Labels
domain: RustInvolves Rust code.Involves Rust code.good first issueGood for newcomersGood for newcomerspriority: somedayIf you need this, please let me know!If you need this, please let me know!state: approvedApproved to proceed.Approved to proceed.type: featureBrand new functionality, features, pages, workflows, endpoints, etc.Brand new functionality, features, pages, workflows, endpoints, etc.work: clearA known solution is (to be) implemented.A known solution is (to be) implemented.
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
ArcorRcagain with no overhead.It would also be useful as common hub to convert between smart pointer types, since any smart pointer with reference count
1and matching encapsulation andRefCounterin this crate should be directly compatible.Describe the solution you'd like
The new
Unique<T>should behave exactly likeArc<T>, with the caveat that it can't be cloned without converting it to the latter first. IfRc<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 fromUnique<T>that do adjust the reference count.Describe alternatives you've considered
None.
Additional context
None.