orgize
orgize copied to clipboard
derive `PartialEq`
allow to easily extract indextree::NodeId
from indextree::Node<Element>
, since Arena<T>.get_node_id
has where T: PartialEq
trait bound (https://docs.rs/indextree/latest/indextree/struct.Arena.html#method.get_node_id)
fn main() {
let input = orgize::Org::parse("* ASD\ntext");
let arena = input.arena();
for node in arena.iter() {
let id: indextree::NodeId = arena.get_node_id(&node).unwrap();
println!("{}", id);
}
}
$ cargo run
1
2
3
4
5
6
7
Edit: users of library crates, usually expect to be able to clone, compare, display, debug, and use stuff as a key in hashmaps (https://rust-lang.github.io/api-guidelines/interoperability.html)