KWARC / rust-libxml

Rust wrapper for libxml2
https://crates.io/crates/libxml
MIT License
76 stars 38 forks source link

NodeReader trait #82

Open dginev opened 3 years ago

dginev commented 3 years ago

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.