Closed smallstepman closed 1 year ago
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)
indextree::NodeId
indextree::Node<Element>
Arena<T>.get_node_id
where T: PartialEq
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)
allow to easily extract
indextree::NodeId
fromindextree::Node<Element>
, sinceArena<T>.get_node_id
haswhere T: PartialEq
trait bound (https://docs.rs/indextree/latest/indextree/struct.Arena.html#method.get_node_id)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)