nnapi 0.2.0

Provides a safe abstraction of the Android NNAPI FFI bindings.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use nnapi_sys::ResultCode;

pub type Result<T> = core::result::Result<T, ResultCode>;

pub trait IntoResult<T> {
    fn into_result(self) -> Result<T>;
}

impl IntoResult<()> for i32 {
    fn into_result(self) -> Result<()> {
        if self == 0 {
            Ok(())
        } else {
            Err(ResultCode::from(self))
        }
    }
}