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

Iter::extend implementation for singly-linked list #38

Open
hawkw opened this issue Feb 1, 2018 · 2 comments
Open

Iter::extend implementation for singly-linked list #38

hawkw opened this issue Feb 1, 2018 · 2 comments

Comments

@hawkw
Copy link
Member

hawkw commented Feb 1, 2018

implementation for boxed lists can be based on 1dcb155, and for UnsafeRef can be based on a153187 (these commits add implementations for doubly-linked lists).

https://github.com/hawkw/alarm/blob/2b0614ae6253ba44ffab2f6b8d3556bee003935b/intruder_alarm/src/doubly/mod.rs#L428-L464

the implementation for lists of UnsafeRefs depends on #37

@leshow
Copy link
Collaborator

leshow commented Feb 8, 2018

these are implemented already I think. Can I ask why we'd want to use UnsafeRef when we have Option<NonNull>, I was under the impression the latter is optimized to be zero-sized when it's None. Under what circumstances do we want to give up that safety?

@hawkw
Copy link
Member Author

hawkw commented Feb 8, 2018

An UnsafeRef is just a NonNull<T> without the Option --- it's for use as an owning reference to a T, which should always exist. It's not wrapped in an Option because we don't expect it to ever be empty and want to enforce that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Intruder Alarm
  
To Do
Development

No branches or pull requests

2 participants