Skip to content
This repository has been archived by the owner on Jul 19, 2020. It is now read-only.

Explore utility of an UnsafeRc #13

Open
hgzimmerman opened this issue Nov 10, 2019 · 0 comments
Open

Explore utility of an UnsafeRc #13

hgzimmerman opened this issue Nov 10, 2019 · 0 comments

Comments

@hgzimmerman
Copy link
Member

There may be utility in creating an Rc-like pointer that when calling as_mut or other mutating functions, does not clone the value it points to to ensure unique ownership. The invariant that would need to be upheld is that no references could be held to values owned by the ptr. Because of Yew's distaste for component lifetimes other than 'static, this may already be impossible to violate within expected operation of Yew.
Nonetheless, any mutating function that would otherwise clone in Mrc should be marked as unsafe to indicate that that particular invariant must be upheld. This would have impacts on ergonomics, but this sort of ability shouldn't be used in application code, and would find its use in component libraries as an optimization invisible to the outside world.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant