File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,20 @@ impl EdgeTable {
358358 /// Get the child column as a slice of the underlying integer type
359359 => child, child_slice_raw, ll_bindings:: tsk_id_t) ;
360360
361+ /// Table column with ergonomic indexing.
362+ ///
363+ /// # Examples
364+ ///
365+ /// ```rust
366+ /// use tskit::TableColumn;
367+ /// let mut edges = tskit::EdgeTable::new().unwrap();
368+ /// // left, right, parent, child
369+ /// let edge: tskit::EdgeId = edges.add_row(0., 10., 1, 0).unwrap();
370+ /// let p = edges.parent_column();
371+ /// assert_eq!(p[edge], 1);
372+ /// assert_eq!(p.get_with_id(edge), Some(&tskit::NodeId::from(1)));
373+ /// assert!(p.get_with_id(tskit::EdgeId::NULL).is_none())
374+ /// ```
361375 pub fn parent_column ( & self ) -> impl crate :: TableColumn < EdgeId , NodeId > + ' _ {
362376 crate :: table_column:: OpaqueTableColumn ( self . parent_slice ( ) )
363377 }
You can’t perform that action at this time.
0 commit comments