Skip to content

Commit 9d8e447

Browse files
committed
doc updates
1 parent 99fdf42 commit 9d8e447

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/tree_interface.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,10 @@ impl TreeInterface {
392392

393393
/// Return an [`Iterator`] from the node `u` to the root of the tree.
394394
///
395-
/// # Errors
395+
/// # Returns
396396
///
397-
/// [`TskitError::IndexError`] if `u` is out of range.
397+
/// * `Some(iterator)` if `u` us valid
398+
/// * `None` otherwise
398399
#[deprecated(since = "0.2.3", note = "Please use Tree::parents instead")]
399400
pub fn path_to_root(&self, u: NodeId) -> Option<impl Iterator<Item = NodeId> + '_> {
400401
self.parents(u)
@@ -403,32 +404,34 @@ impl TreeInterface {
403404
/// Return an [`Iterator`] from the node `u` to the root of the tree,
404405
/// travering all parent nodes.
405406
///
406-
/// # Errors
407+
/// # Returns
407408
///
408-
/// [`TskitError::IndexError`] if `u` is out of range.
409+
/// * `Some(iterator)` if `u` is valid
410+
/// * `None` otherwise
409411
pub fn parents(&self, u: NodeId) -> Option<impl Iterator<Item = NodeId> + '_> {
410412
ParentsIterator::new(self, u)
411413
}
412414

413415
/// Return an [`Iterator`] over the children of node `u`.
416+
/// # Returns
414417
///
415-
/// # Errors
416-
///
417-
/// [`TskitError::IndexError`] if `u` is out of range.
418+
/// * `Some(iterator)` if `u` is valid
419+
/// * `None` otherwise
418420
pub fn children(&self, u: NodeId) -> Option<impl Iterator<Item = NodeId> + '_> {
419421
ChildIterator::new(self, u)
420422
}
423+
421424
/// Return an [`Iterator`] over the sample nodes descending from node `u`.
422425
///
423426
/// # Note
424427
///
425428
/// If `u` is itself a sample, then it is included in the values returned.
426-
/// Returns `None` if `u` is out of range.
427-
///
428-
/// # Errors
429+
///
430+
/// # Returns
429431
///
430-
/// [`TskitError::NotTrackingSamples`] if [`TreeFlags::SAMPLE_LISTS`] was not used
431-
/// to initialize `self`.
432+
/// * Some(Ok(iterator)) if [`TreeFlags::SAMPLE_LISTS`] is in [`TreeInterface::flags`]
433+
/// * Some(Err(_)) if [`TreeFlags::SAMPLE_LISTS`] is not in [`TreeInterface::flags`]
434+
/// * None if `u` is not valid.
432435
pub fn samples(
433436
&self,
434437
u: NodeId,

0 commit comments

Comments
 (0)