summaryrefslogtreecommitdiff
path: root/src/userdata_impl.rs
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2022-04-17 17:29:51 +0100
committerAlex Orlenko <zxteam@protonmail.com>2022-04-17 17:29:51 +0100
commita62636fde0c48db7582f6a289382efaddecb455d (patch)
tree93640379b60ef04430f31740c07aa11d35f3008e /src/userdata_impl.rs
parentd77c0e3b8d497898a95f0084a3288b4b48a91de7 (diff)
downloadmlua-a62636fde0c48db7582f6a289382efaddecb455d.zip
More parking_lot ci tests
Diffstat (limited to 'src/userdata_impl.rs')
-rw-r--r--src/userdata_impl.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/userdata_impl.rs b/src/userdata_impl.rs
index 9ab3757..913bd73 100644
--- a/src/userdata_impl.rs
+++ b/src/userdata_impl.rs
@@ -309,24 +309,26 @@ impl<'lua, T: 'static + UserData> StaticUserDataMethods<'lua, T> {
}
Some(id) if id == TypeId::of::<Arc<Mutex<T>>>() => {
let ud = get_userdata_mut::<Arc<Mutex<T>>>(lua.state)?;
- let mut ud = ud.try_lock().map_err(|_| Error::UserDataBorrowError)?;
+ let mut ud =
+ ud.try_lock().map_err(|_| Error::UserDataBorrowMutError)?;
method(lua, &mut ud, A::from_lua_multi(args, lua)?)?.to_lua_multi(lua)
}
#[cfg(feature = "parking_lot")]
Some(id) if id == TypeId::of::<Arc<parking_lot::Mutex<T>>>() => {
let ud = get_userdata_mut::<Arc<parking_lot::Mutex<T>>>(lua.state)?;
- let mut ud = ud.try_lock().ok_or(Error::UserDataBorrowError)?;
+ let mut ud = ud.try_lock().ok_or(Error::UserDataBorrowMutError)?;
method(lua, &mut ud, A::from_lua_multi(args, lua)?)?.to_lua_multi(lua)
}
Some(id) if id == TypeId::of::<Arc<RwLock<T>>>() => {
let ud = get_userdata_mut::<Arc<RwLock<T>>>(lua.state)?;
- let mut ud = ud.try_write().map_err(|_| Error::UserDataBorrowError)?;
+ let mut ud =
+ ud.try_write().map_err(|_| Error::UserDataBorrowMutError)?;
method(lua, &mut ud, A::from_lua_multi(args, lua)?)?.to_lua_multi(lua)
}
#[cfg(feature = "parking_lot")]
Some(id) if id == TypeId::of::<Arc<parking_lot::RwLock<T>>>() => {
let ud = get_userdata_mut::<Arc<parking_lot::RwLock<T>>>(lua.state)?;
- let mut ud = ud.try_write().ok_or(Error::UserDataBorrowError)?;
+ let mut ud = ud.try_write().ok_or(Error::UserDataBorrowMutError)?;
method(lua, &mut ud, A::from_lua_multi(args, lua)?)?.to_lua_multi(lua)
}
_ => Err(Error::UserDataTypeMismatch),