1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
use super::api::WrapperApi;
use super::super::raw::Library;
use super::super::Error;

impl<T> WrapperApi for Option<T>
where
    T: WrapperApi,
{
    unsafe fn load(lib: &Library) -> Result<Self, Error> {
        match T::load(lib) {
            Ok(val) => Ok(Some(val)),
            Err(_) => Ok(None),
        }
    }
}