tnnl 0.1.16

tnnl gives you full control over whether and when your IoT devices should be reachable from the internet
// build.rs
use std::env;
use std::fs;
use std::path::PathBuf;

fn main() {
    let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
    let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
    let header_path = out_dir.join("tnnl.h");

    // Generate the header
    cbindgen::generate(&crate_dir)
        .expect("Unable to generate bindings")
        .write_to_file(&header_path);

    // Optional: copy to project root or another location
    let dest = PathBuf::from("include/tnnl.h");
    fs::create_dir_all(dest.parent().unwrap()).unwrap();
    fs::copy(&header_path, &dest).expect("Could not copy header file");
}