Skip to content

Commit 18e6dc0

Browse files
committed
Fix broken doc link for Tree::traverse_nodes.
update README update crate-level docs
1 parent f905b9c commit 18e6dc0

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ This package provides the following:
88

99
1. Low-level bindings to the C API of both `tskit` and `kastore`.
1010
We use [bindgen](https://docs.rs/bindgen) to automatically generate the bindings.
11-
2. The struct `tskit::TableCollection`, which wraps
12-
`tsk_table_collection_t`. The wrapper is currently
13-
incomplete, supporting only node, edge, site,
14-
mutation, and population tables. The remaining
15-
tables will happen "soon".
11+
2. Support for table collections, tree sequences, and tree iteration.
1612
3. An error handling system that maps `tskit` error
1713
codes to `rust` errors while preserving error messages.
1814

@@ -26,8 +22,6 @@ The overview is:
2622
The result is a `rust` library with all of these two C libraries statically compiled in.
2723
Further, `rust` types and functions exist in the module name `tskit::bindings`, allowing `unsafe` access to the low-level API.
2824

29-
In the future, we hope to develop a more "rusty" front-end, hiding the `unsafe` bits from client code.
30-
3125
Help wanted!
3226

3327
## Quick start guide

src/lib.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
//! A rust interface to [tskit](https://github.com/tskit-dev/tskit).
2+
//!
3+
//! This crate provides a mapping of the `tskit` C API to rust.
4+
//! The result is an interface similar to the `tskit` Python interface,
5+
//! but with all operations implemented using compiled code.
6+
//!
7+
//! # Features
8+
//!
9+
//! ## Interface to the C library
10+
//!
11+
//! * [`TableCollection`] wraps `tsk_table_collection_t`.
12+
//! * [`TreeSequence`] wraps `tsk_treeseq_t`.
13+
//! * [`Tree`] wraps `tsk_tree_t`.
14+
//! * Tree iteration occurs via traits from [streaming_iterator](https://docs.rs/streaming-iterator/).
15+
//! * Errors returned from C map to [`TskitError::ErrorCode`].
16+
//!
17+
//! ## Safety
18+
//!
19+
//! * The types listed above handle all the memory management!
20+
//! * All array accesses are range-checked.
21+
//! * Object lifetimes are clear:
22+
//! * Creating a tree sequence moves/consumes a table collection.
23+
//! * Tree lifetimes are tied to that of the parent tree sequence.
24+
//! * Table objects ([`NodeTable`], etc..) are only represented by non-owning, immutable types.
25+
//!
26+
//! # What is missing?
27+
//!
28+
//! * A lot of wrappers to the C functions.
29+
//! * Tree sequence statistics!
230
331
#![allow(non_upper_case_globals)]
432
#![allow(non_camel_case_types)]

src/table_collection.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ use ll_bindings::tsk_table_collection_free;
109109
/// 1. Support all table types. Currently, we only support
110110
/// those needed for current goals in ongoing projects.
111111
/// 2. Strengthen some of the error handling.
112-
///
113-
/// Addressing point 3 may require API breakage.
114112
pub struct TableCollection {
115113
inner: Box<ll_bindings::tsk_table_collection_t>,
116114
}

src/trees.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl Tree {
290290
///
291291
/// # Errors
292292
///
293-
/// [`TskitError`] may be returned via [`Tree::nodes`].
293+
/// [`TskitError`] may be returned via [`Tree::traverse_nodes`].
294294
pub fn total_branch_length(&self, by_span: bool) -> Result<f64, TskitError> {
295295
let nt = self.node_table();
296296
let mut b = 0.;
@@ -388,7 +388,7 @@ impl streaming_iterator::DoubleEndedStreamingIterator for Tree {
388388
}
389389

390390
/// Specify the traversal order used by
391-
/// [`Tree::nodes`].
391+
/// [`Tree::traverse_nodes`].
392392
pub enum NodeTraversalOrder {
393393
///Preorder traversal, starting at the root(s) of a [`Tree`].
394394
///For trees with multiple roots, start at the left root,

0 commit comments

Comments
 (0)