mod crate 선언
build.rs binding in lib.rs
lib.rs
file can include the generated bindings and allows the Rust code to interact with the C functions.
- The
#![allow(...)]
attributes are used to suppress warnings about naming conventions.
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
: This line includes the generated bindings file, which is created by bindgen during the build process.
Source code usage
- The
extern "C"
block declares theimage_classifier
function from the Darknet library, making it available for use in Rust.
- This function can be called from the Rust code as if it were a normal Rust function.