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 weak pointers #2

Open
glebpom opened this issue Apr 24, 2020 · 4 comments
Open

Support weak pointers #2

glebpom opened this issue Apr 24, 2020 · 4 comments

Comments

@glebpom
Copy link

glebpom commented Apr 24, 2020

Thanks for your work on this crate!

Are there any plans to support Weak pointers?

@orium
Copy link
Owner

orium commented Apr 26, 2020

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.

@glebpom
Copy link
Author

glebpom commented Apr 27, 2020

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?

@orium
Copy link
Owner

orium commented Apr 27, 2020

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.

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

No branches or pull requests

3 participants
@glebpom @orium and others