@@ -184,7 +184,7 @@ impl<'a> NodeTable<'a> {
184
184
/// is `true`.
185
185
pub fn samples_as_vector ( & self ) -> Vec < tsk_id_t > {
186
186
let mut samples: Vec < tsk_id_t > = vec ! [ ] ;
187
- for row self. iter( false ) {
187
+ for row in self . iter ( false ) {
188
188
if row. flags & crate :: TSK_NODE_IS_SAMPLE > 0 {
189
189
samples. push ( row. id ) ;
190
190
}
@@ -218,20 +218,19 @@ impl<'a> NodeTable<'a> {
218
218
/// tables
219
219
/// .add_node(tskit::TSK_NODE_IS_SAMPLE, 1.0, TSK_NULL, TSK_NULL)
220
220
/// .unwrap();
221
- /// let samples = tables.create_node_id_vector(
222
- /// |row: &tskit::NodeTableRow, _: tsk_id_t | row.time > 0.,
221
+ /// let samples = tables.nodes(). create_node_id_vector(
222
+ /// |row: &tskit::NodeTableRow| row.time > 0.,
223
223
/// );
224
224
/// assert_eq!(samples[0], 1);
225
225
///
226
226
/// // Get all nodes that have a mutation:
227
227
///
228
228
/// fn node_has_mutation(
229
- /// tables : &tskit::TableCollection ,
229
+ /// tabled_type : &dyn tskit::TableAccess ,
230
230
/// row: &tskit::NodeTableRow,
231
- /// i: tsk_id_t,
232
231
/// ) -> bool {
233
- /// for mrow in tables .mutations_iter(false) {
234
- /// if mrow.node == i {
232
+ /// for mrow in tabled_type .mutations_iter(false) {
233
+ /// if mrow.node == row.id {
235
234
/// return true;
236
235
/// }
237
236
/// }
@@ -241,8 +240,8 @@ impl<'a> NodeTable<'a> {
241
240
/// // Get all nodes that have a mutation:
242
241
///
243
242
/// tables.add_mutation(0, 0, TSK_NULL, 0.0, None).unwrap();
244
- /// let samples_with_mut = tables.create_node_id_vector(
245
- /// |row: &tskit::NodeTableRow, i: tsk_id_t | node_has_mutation(&tables, row, i ));
243
+ /// let samples_with_mut = tables.nodes(). create_node_id_vector(
244
+ /// |row: &tskit::NodeTableRow| node_has_mutation(&tables, row));
246
245
/// assert_eq!(samples_with_mut[0], 0);
247
246
/// ```
248
247
pub fn create_node_id_vector (
0 commit comments