Skip to main content

libparasail_sys/
lib.rs

1//! # Introduction
2//! [libparasail-sys]() is a Rust crate that provides FFI bindings to
3//! [parasail](https://github.com/jeffdaily/parasail), a SIMD C
4//! library for pairwise sequence alignment. You may be interested in its parent crate, [parasail-rs](https://github.com/nsbuitrago/parasail-rs).
5//!
6//! For mor information on parasail, see the original C library [repository](https://github.com/jeffdaily/parasail).
7
8#![allow(non_upper_case_globals)]
9#![allow(non_camel_case_types)]
10#![allow(non_snake_case)]
11include!(concat!(env!("OUT_DIR"), "/parasail_bindings.rs"));
12
13#[cfg(test)]
14mod tests {
15    use super::*;
16    use std::ffi::CString;
17
18    #[test]
19    fn call_parasail_nw() {
20        unsafe {
21            let alphabet = CString::new("ACGT").unwrap();
22            let matrix = parasail_matrix_create(alphabet.as_ptr(), 2, -1);
23            assert!(!matrix.is_null());
24
25            let s1 = CString::new("ACGT").unwrap();
26            let s2 = CString::new("ACGT").unwrap();
27            let result = parasail_nw(s1.as_ptr(), 4, s2.as_ptr(), 4, 5, 1, matrix);
28            assert!(!result.is_null());
29            assert_eq!((*result).score, 8);
30
31            parasail_result_free(result);
32            parasail_matrix_free(matrix);
33        }
34    }
35}