vips_sys/
lib.rs

1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4
5// Unification only includes bindings generated during build time
6include!(concat!(env!("OUT_DIR"), "/binding.rs"));
7
8// Optional minimum safety package for easy initialization and shutdown (without changing the positioning of -sys)
9#[cfg(feature = "helpers")]
10pub mod helpers {
11    use super::*;
12    pub fn init(argv0: &str) -> Result<(), i32> {
13        let c = std::ffi::CString::new(argv0).unwrap();
14        let rc = unsafe { vips_init(c.as_ptr()) };
15        if rc == 0 {
16            Ok(())
17        } else {
18            Err(rc)
19        }
20    }
21    pub fn shutdown() {
22        unsafe { vips_shutdown() }
23    }
24    pub fn version() -> (i32, i32, i32) {
25        unsafe { (vips_version(0), vips_version(1), vips_version(2)) }
26    }
27}