27 unstable releases

0.15.0-alpha.0 May 7, 2024
0.14.1 Apr 16, 2023
0.14.0 Mar 17, 2023
0.12.0 Dec 23, 2022
0.1.1 Mar 26, 2021

#152 in Data structures

Download history 11/week @ 2024-03-08 20/week @ 2024-03-15 1/week @ 2024-03-22 29/week @ 2024-03-29 2/week @ 2024-04-05 87/week @ 2024-04-12 41/week @ 2024-04-19 39/week @ 2024-04-26 94/week @ 2024-05-03 18/week @ 2024-05-10 70/week @ 2024-05-17 70/week @ 2024-05-24 109/week @ 2024-05-31 24/week @ 2024-06-07

156 downloads per month
Used in forrustts

MIT license

1MB
28K SLoC

C 21K SLoC // 0.1% comments Rust 6.5K SLoC // 0.0% comments

rust bindings for tskit

CI tests

This crate provides rust bindings to tskit.

This package provides the following:

  1. Low-level bindings to the C API of both tskit and kastore. We use bindgen to automatically generate the bindings.
  2. Support for table collections, tree sequences, and tree iteration.
  3. An error handling system that maps tskit error codes to rust errors while preserving error messages.

The overview is:

  1. tskit and kastore C code are include in subprojects/
  2. These two tools are compiled into the rust package.
  3. Then bindgen generates the bindings.
  4. Finally, the entire rust package is generated.

The result is a rust library with all of these two C libraries statically compiled in. Further, rust types and functions exist in the module name tskit::bindings, allowing unsafe access to the low-level API.

Help wanted!

Quick start guide

Cloning the repository and running the test suite

git clone https://github.com/tskit-dev/tskit-rust
cd tskit-rust
cargo test --all-features

Viewing the documentation

cargo doc --all-features --open

Calculating code coverage

First, install tarpaulin:

cargo install cargo-tarpaulin

Then, we use all tests, doc tests, and example programs to calculate code coverage for all available features:

cargo tarpaulin --all-features --doc --tests --examples --exclude-files '*.c' --exclude-files '*.h' --ignore-tests  -o html

Then, point your favorite browser to tarpaulin-report.html.

The last few flags exclude the C code and any rust code that is test-only from being part of the denominator of the coverage calculation. The goal here is not to have high test coverage of the C API, as it is up to the upstream project to provide that.

Note: tarpaulin can be fickle, and changing the order of some of those flags can cause the coverage run to fail.

Change log

See here.

Updating the change log.

under scrutinty

Example:

git cliff -u --tag v0.11.0 --date-order -p CHANGELOG.md

Dependencies

~0.5–3MB
~68K SLoC