diff options
author | kyren <kerriganw@gmail.com> | 2017-09-30 01:27:18 -0400 |
---|---|---|
committer | kyren <kerriganw@gmail.com> | 2017-09-30 01:27:18 -0400 |
commit | c5a4dfd7ebed829109a320ae803cefb8d5168fc7 (patch) | |
tree | 9f89ed34cf8c4062fe55070dc7fc1e05c47367f7 /src/userdata.rs | |
parent | 8324d9e648aaf776830b9185688efd157ce2d97d (diff) | |
download | mlua-c5a4dfd7ebed829109a320ae803cefb8d5168fc7.zip |
more reorganization, move simple type defines to types.rs module
Diffstat (limited to 'src/userdata.rs')
-rw-r--r-- | src/userdata.rs | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/src/userdata.rs b/src/userdata.rs index 7b0d40b..3aee9bc 100644 --- a/src/userdata.rs +++ b/src/userdata.rs @@ -1,17 +1,13 @@ use std::cell::{RefCell, Ref, RefMut}; use std::marker::PhantomData; use std::collections::HashMap; -use std::os::raw::c_void; use std::string::String as StdString; use ffi; use error::*; use util::*; -use lua::{FromLua, FromLuaMulti, ToLuaMulti, Callback, LuaRef, Lua}; - -/// A "light" userdata value. Equivalent to an unmanaged raw pointer. -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub struct LightUserData(pub *mut c_void); +use types::{Callback, LuaRef}; +use lua::{FromLua, FromLuaMulti, ToLuaMulti, Lua}; /// Kinds of metamethods that can be overridden. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] @@ -400,33 +396,11 @@ impl<'lua> AnyUserData<'lua> { #[cfg(test)] mod tests { - use super::{LightUserData, UserData, MetaMethod, UserDataMethods}; + use super::{UserData, MetaMethod, UserDataMethods}; use error::ExternalError; use string::String; use lua::{Function, Lua}; - use std::os::raw::c_void; - - #[test] - fn test_lightuserdata() { - let lua = Lua::new(); - let globals = lua.globals(); - lua.exec::<()>( - r#" - function id(a) - return a - end - "#, - None, - ).unwrap(); - let res = globals - .get::<_, Function>("id") - .unwrap() - .call::<_, LightUserData>(LightUserData(42 as *mut c_void)) - .unwrap(); - assert_eq!(res, LightUserData(42 as *mut c_void)); - } - #[test] fn test_user_data() { struct UserData1(i64); |