libde265_rs/
lib.rs

1// only enables the `doc_auto_cfg` feature when
2// the `docsrs` configuration attribute is defined
3#![cfg_attr(docsrs, feature(doc_auto_cfg))]
4#![doc = include_str!("../README.md")]
5
6mod decoder;
7mod errors;
8mod image;
9
10pub use decoder::*;
11pub use errors::*;
12pub use image::*;
13
14/// Returns a version of a `libde265` library as an array of version parts -
15/// [major, minor, maintenance].
16pub fn version() -> [u8; 3] {
17    let major = unsafe { libde265_sys::de265_get_version_number_major() } as u8;
18    let minor = unsafe { libde265_sys::de265_get_version_number_minor() } as u8;
19    let maintenance = unsafe { libde265_sys::de265_get_version_number_maintenance() } as u8;
20    [major, minor, maintenance]
21}
22
23pub fn disable_logging() {
24    unsafe { libde265_sys::de265_disable_logging() };
25}
26
27pub fn set_verbosity(level: u8) {
28    unsafe { libde265_sys::de265_set_verbosity(level as _) };
29}
30
31#[cfg(test)]
32mod tests {
33    use super::*;
34
35    #[test]
36    fn test_version() {
37        let version = version();
38        assert_eq!(version[0], 1);
39        assert_eq!(version[1], 0);
40    }
41}