-
Notifications
You must be signed in to change notification settings - Fork 21
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
Prototype Dlist rewrite with cursor #11
Conversation
Cursor stuff is now implemented. I believe it also fully handles pcwalton's usecase, now. |
|
||
/// Converts the ref to an Option containing a reference. | ||
#[inline] | ||
fn as_ref(&self) -> Option<& Node<T>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this still isn't safe:
let raw = {
let mut node = Node::new(1u);
Raw::some(&mut node)
};
// Now the node is dead. However, we can still access it.
let ref = raw.as_ref().unwrap();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, totally. Still safer than std::DList (can't promote &DList to &mut DList), but not Safe. Littering everything with unsafe
is super shitty, though, and I don't see any reasonable way to make DList safe. :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, we could just make Raw::some unsafe and say "be careful with raws".
This isn't perfect by any means, but I want to land this so people can play around with it. This library is about experiments. |
Prototype Dlist rewrite with cursor
No description provided.