Crate tskit[−][src]
A rust interface to tskit.
This crate provides a mapping of the tskit
C API to rust.
The result is an interface similar to the tskit
Python interface,
but with all operations implemented using compiled code.
Features
Interface to the C library
TableCollection
wrapstsk_table_collection_t
.TreeSequence
wrapstsk_treeseq_t
.Tree
wrapstsk_tree_t
.- Tree iteration occurs via traits from streaming_iterator.
- Errors returned from C map to
TskitError::ErrorCode
. Their string messages can be obtained by printing the error type.
Safety
- The types listed above handle all the memory management!
- All array accesses are range-checked.
- Object lifetimes are clear:
- Creating a tree sequence moves/consumes a table collection.
- Tree lifetimes are tied to that of the parent tree sequence.
- Table objects (
NodeTable
, etc..) are only represented by non-owning, immutable types.
Optional features
Some features are optional, and are activated by requesting them in your Cargo.toml
file.
provenance
- Enables
provenance
- Enables
To add features to your Cargo.toml
file:
[dependencies]
tskit = {version = "0.2.0", features=["feature0", "feature1"]}
What is missing?
- A lot of wrappers to the C functions.
- Tree sequence statistics!
Re-exports
pub use bindings::TSK_NODE_IS_SAMPLE; | |
pub use bindings::tsk_flags_t; | |
pub use bindings::tsk_id_t; | |
pub use bindings::tsk_size_t; | |
pub use error::TskitError; |
Modules
bindings | Low-level (“unsafe”) bindings to the C API. |
error | Error handling |
ffi | Define traits related to wrapping tskit stuff |
metadata | |
provenance | Optional module for table and tree sequence provenance tables. |
types | “Other” tskit types live here. |
Structs
Enums
NodeTraversalOrder | Specify the traversal order used by
|
Constants
TSK_NULL | “Null” identifier value. |
Traits
NodeIterator | Trait defining iteration over nodes. |
NodeListGenerator | Interface for returning lists of node ids from
types implementing |
TableAccess | Immutable access to tables. |
TskitTypeAccess | Provide pointer access to underlying C types |
Functions
c_api_major_version | C API major version |
c_api_minor_version | C API minor version |
c_api_patch_version | C API patch version |
c_api_version | The C API version in MAJOR.MINOR.PATCH format |
version | Version of the rust crate. |
Type Definitions
TskReturnValue | Handles return codes from low-level tskit functions. |