diff --git a/src/node_table.rs b/src/node_table.rs index b48c395e4..d07a7678e 100644 --- a/src/node_table.rs +++ b/src/node_table.rs @@ -88,6 +88,21 @@ impl<'a> NodeTable<'a> { /// /// * `Some(time)` if `row` is valid. /// * `None` otherwise. + /// + /// # Examples + /// + /// ``` + /// # use tskit::prelude::*; + /// # let mut tables = tskit::TableCollection::new(10.).unwrap(); + /// # tables.add_node(0, 10.0, -1, -1).unwrap(); + /// if let Some(time) = tables.nodes().time(0) { + /// // then node id 0 is a valid row id + /// # assert_eq!(time, 10.0); + /// } + /// # else { + /// # panic!("expected 0 to be a valid row id") + /// # } + /// ``` pub fn time + Copy>(&'a self, row: N) -> Option