archery
archery copied to clipboard
Support weak pointers
Thanks for your work on this crate!
Are there any plans to support Weak pointers?
Hi.
Definitely something I wanted to do. I might pick that up when I have time. Meanwhile if you or anyone else wants to work on that just let me know.
I was looking at the code a bit, and it seems that it's not clear how to implement it exactly in terms of traits and associated types.
The first idea which comes to my mind is to add the WeakPointerKind
trait and an associated type WeakPointer
(restricted to WeakPointerKind
trait) to SharedPointerKind
.
What do you think?
Yes, I think that will work. It is pretty much analogous to the SharedPointer
and SharedPointerKind
.
However, to implement WeakPointer::upgrade()
will be a bit tricker, but I think it can be done, but even without that method having a weak pointer already adds a lot of value.