Update load function
This commit is contained in:
parent
36d2ba034c
commit
7609e94025
1 changed files with 4 additions and 8 deletions
12
src/lib.rs
12
src/lib.rs
|
@ -81,12 +81,8 @@ pub struct LipcApi {
|
|||
impl LipcApi {
|
||||
const DEFAULT_NAME: &str = "liblipc.so";
|
||||
|
||||
pub fn load(path: Option<&str>) -> Result<Container<Self>> {
|
||||
let name = match path {
|
||||
Some(x) => x,
|
||||
None => Self::DEFAULT_NAME,
|
||||
};
|
||||
let cont: Container<Self> = unsafe { Container::load(name) }?;
|
||||
pub fn load(name: Option<&str>) -> Result<Container<Self>> {
|
||||
let cont: Container<Self> = unsafe { Container::load(name.unwrap_or(Self::DEFAULT_NAME)) }?;
|
||||
|
||||
Ok(cont)
|
||||
}
|
||||
|
@ -99,8 +95,8 @@ pub struct Lipc {
|
|||
|
||||
impl Lipc {
|
||||
pub fn new(api: Container<LipcApi>) -> Result<Self> {
|
||||
let lipc = unsafe { (api.lipc_open_no_name)() };
|
||||
if lipc == (std::ptr::null_mut() as *mut c_void) {
|
||||
let lipc: *mut LipcType = unsafe { (api.lipc_open_no_name)() };
|
||||
if lipc == std::ptr::null_mut() {
|
||||
bail!("Failed to create connection!");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue