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

Prototype Dlist rewrite with cursor #11

Merged
merged 10 commits into from
Dec 15, 2014
Merged

Prototype Dlist rewrite with cursor #11

merged 10 commits into from
Dec 15, 2014

Conversation

Gankra
Copy link
Owner

@Gankra Gankra commented Nov 30, 2014

No description provided.

@Gankra
Copy link
Owner Author

Gankra commented Nov 30, 2014

CC @aturon @gereeter @huonw @cgaebel

More work to do, but you might be interested.

@Gankra
Copy link
Owner Author

Gankra commented Nov 30, 2014

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>> {
Copy link
Collaborator

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();

Copy link
Owner Author

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. :(

Copy link
Owner Author

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".

@Gankra
Copy link
Owner Author

Gankra commented Dec 15, 2014

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.

Gankra added a commit that referenced this pull request Dec 15, 2014
Prototype Dlist rewrite with cursor
@Gankra Gankra merged commit 6d62f08 into master Dec 15, 2014
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

Successfully merging this pull request may close these issues.

3 participants