pub fn load<P: AsRef<Path>>(path: &P) -> Result<Module, Error> {
        let ext = CString::new(
            path.as_ref()
                .extension()
                .unwrap_or(std::ffi::OsStr::new(""))
                .to_str()
                .ok_or_else(|| {
                    format_err!("Bad module load path: `{}`.", path.as_ref().display())
                })?,
        )?;
        let func = Function::get("module._LoadFromFile").expect("API function always exists");
        let cpath =
            CString::new(path.as_ref().to_str().ok_or_else(|| {
                format_err!("Bad module load path: `{}`.", path.as_ref().display())
            })?)?;
        let ret: Module = call_packed!(func, cpath.as_c_str(), ext.as_c_str())?.try_into()?;
        Ok(ret)
    }
/// Loads a module shared library from path.
Loads a module shared library from path.
Loads a module shared library from path .
pub fn load<P: AsRef<Path>>(path: &P) -> Result<Module, Error> {
        let ext = CString::new(
            path.as_ref()
                .extension()
                .unwrap_or(std::ffi::OsStr::new(""))
                .to_str()
                .ok_or_else(|| {
                    format_err!("Bad module load path: `{}`.", path.as_ref().display())
                })?,
        )?;
        let func = Function::get("module._LoadFromFile").expect("API function always exists");
        let cpath =
            CString::new(path.as_ref().to_str().ok_or_else(|| {
                format_err!("Bad module load path: `{}`.", path.as_ref().display())
            })?)?;
        let ret: Module = call_packed!(func, cpath.as_c_str(), ext.as_c_str())?.try_into()?;
        Ok(ret)
    }
pub fn load < P : AsRef < Path > > ( path : & P ) -> Result < Module , Error > { let ext = CString :: new ( path . as_ref ( ) . extension ( ) . unwrap_or ( std :: ffi :: OsStr :: new ( " " ) ) . to_str ( ) . ok_or_else ( | | { format_err ! ( " " path as_ref ( ) display ( ) ) } ) ? , ) ? ; let func = Function :: get ( " " ) . expect ( " " ) ; let cpath = CString :: new ( path . as_ref ( ) . to_str ( ) . ok_or_else ( | | { format_err ! ( " " path as_ref ( ) display ( ) ) } ) ? ) ? ; let ret : Module = call_packed ! ( func cpath as_c_str ( ) ext as_c_str ( ) ) ? . try_into ( ) ? ; Ok ( ret ) }
Loads a module shared library from path.
Loads a module shared library from path .
path
&P
path
&P