orgize icon indicating copy to clipboard operation
orgize copied to clipboard

derive `PartialEq`

Open smallstepman opened this issue 2 years ago • 0 comments

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)

smallstepman avatar Mar 04 '22 23:03 smallstepman