Skip to content

Commit 8f7449a

Browse files
committed
1 parent 569e8ca commit 8f7449a

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ fn main() {
5353
// Write the bindings to the $OUT_DIR/bindings.rs file.
5454
//let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
5555
bindings
56-
.write_to_file("src/bindings.rs")
56+
.write_to_file("src/auto_bindings.rs")
5757
.expect("Couldn't write bindings!");
5858
}

src/bindings.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// re-export the auto-generate bindings
2+
pub use crate::auto_bindings::*;
3+
4+
// tskit defines this via a type cast
5+
// in a macro. bindgen thus misses it.
6+
// See bindgen issue 316.
7+
pub const TSK_NULL: tsk_id_t = -1;
8+

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@
3131
/// This module contains the same types/functions with the same names.
3232
pub mod bindings;
3333

34+
mod auto_bindings;
35+
3436
// Testing modules
3537
mod test_table_collection;
38+
mod test_tsk_variables;

src/test_tsk_variables.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// These tests basically make sure that we
2+
// can actually bind these things
3+
4+
#[cfg(test)]
5+
mod tests
6+
{
7+
use crate::*;
8+
9+
#[test]
10+
fn test_node_is_sample()
11+
{
12+
let mut x = bindings::TSK_NODE_IS_SAMPLE;
13+
assert!(x > 0);
14+
}
15+
16+
#[test]
17+
fn test_tsk_null()
18+
{
19+
assert_eq!(bindings::TSK_NULL, -1);
20+
}
21+
}

0 commit comments

Comments
 (0)