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

Hide Node::data field and export Node::get{,_mut}() #52

Merged
merged 2 commits into from
Aug 4, 2019

Conversation

lo48576
Copy link
Contributor

@lo48576 lo48576 commented Aug 4, 2019

This is breaking change.

Currently Node::data field is public, but it is very strong restriction for internal representation of the node.
Instead, it may be better to export Node::get() -> &T and Node::get_mut() -> &mut T, and hide Node::data field.

See Future proofing - Rust API Guidelines.

Currently `Node::data` field is public, but it is very strong
restriction for internal representation of the node.
Instead, it may be better to export `Node::get() -> &T` and
`Node::get_mut() -> &mut T`, and hide `Node::data` field.

See [Future proofing - Rust API Guidelines](https://rust-lang-nursery.github.io/api-guidelines/future-proofing.html#structs-have-private-fields-c-struct-private).
`Arena::new_node()` does not need to know `Node`'s internals.
Copy link
Owner

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree 👍

@saschagrunert saschagrunert merged commit f91c0a0 into saschagrunert:master Aug 4, 2019
@lo48576 lo48576 deleted the feature/hide-data-field branch August 4, 2019 16:23
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.

None yet

2 participants