Skip to main content

russimp_sys_ng/
lib.rs

1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4#![allow(improper_ctypes)]
5
6pub mod built_info {
7    include!(concat!(env!("OUT_DIR"), "/built.rs"));
8}
9
10include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
11
12impl From<aiString> for String {
13    fn from(string: aiString) -> Self {
14        unsafe {
15            std::str::from_utf8(std::slice::from_raw_parts(
16                string.data.as_ptr() as *const u8,
17                string.length as _,
18            ))
19        }
20        .unwrap()
21        .into()
22    }
23}
24
25impl From<&aiString> for String {
26    fn from(string: &aiString) -> Self {
27        unsafe {
28            std::str::from_utf8(std::slice::from_raw_parts(
29                string.data.as_ptr() as *const u8,
30                string.length as _,
31            ))
32        }
33        .unwrap()
34        .into()
35    }
36}
37
38#[cfg(test)]
39mod tests {
40    use super::*;
41
42    /// A simple test to make sure assimp library linked properly.
43    #[test]
44    fn test_version() {
45        let _ = unsafe { aiGetVersionMajor() };
46    }
47}