-
Notifications
You must be signed in to change notification settings - Fork 42
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
Replace unsafe raw pointers to the node tree #151
base: main
Are you sure you want to change the base?
Conversation
@matthunz This mostly all looks pretty good, but:
You might also want to consider making the type: struct NodeHandle<'a> {
doc: &'a Document,
node: &'a Node,
} Which would allow the type to implement more things. I think we should also look at adding a struct NodeHandleMut<'a> {
doc: &mut 'a Document,
node_id: NodeId,
} which would allow a lot of the methods from |
Thanks for the review!
Definitely! I think I got sucked into a bit of a rabbit hole here... I'll try to factor out the less controversial stuff
Ooo yeah I actually like that a lot better
That sounds interesting too, it does sound like we'd have more flexibility to add things. I also really like the mutable handle for the same reasons. Just to clarify on that todo task though unfortunately it looks like |
The methods for
Node
currently seem unsafe, as aNode
can outlive its tree field of*mut Slab<Node>
. It is also possible to obtain mutable references to the same node.Node
fields and methods