liblcrq_sys/lib.rs
1// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
2// Copyright (c) 2025 Gavin Henry <ghenry@sentrypeer.org>
3
4// Ignore Rust's style conventions for our C FFI bindings
5#![allow(non_upper_case_globals)]
6#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8
9// Use the include! macro to dump our generated bindings right into our crate's main entry point,
10// src/lib.rs:
11include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
12
13// Some basic tests to ensure that our bindings are working as expected with
14// the liblcrq C API
15
16#[cfg(test)]
17mod tests {
18 use super::*;
19
20 #[test]
21 fn test_lc_calls() {
22 unsafe {
23 // initialize the RaptorQ context
24 // See test/0000-0003.c
25 let lcrq_ctx = rq_init(345893, 1024);
26 assert!(!lcrq_ctx.is_null());
27
28 // free the RaptorQ context
29 rq_free(lcrq_ctx);
30 }
31 }
32}