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

NodeReader trait #82

Open
dginev opened this issue Feb 1, 2021 · 0 comments
Open

NodeReader trait #82

dginev opened this issue Feb 1, 2021 · 0 comments

Comments

@dginev
Copy link
Member

dginev commented Feb 1, 2021

I continue using mostly RoNode in my main code, since most of my traversals are read-only and the benefit is significant. I just ended up adding a handful of identical methods to both Node and RoNode and the redundancy is quite obvious+painful.

I think all of the read-only methods can be extracted out as a trait, and then have very simple default implementations for both structs:

impl NodeReader for Node {}
impl NodeReader for RoNode {}

and cut the code footprint in half. Not urgent, but definitely needed if the two structs are to coexist in peace going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant