File tree Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,13 @@ lua52 = []
33
33
lua51 = []
34
34
luajit = []
35
35
vendored = [" lua-src" , " luajit-src" ]
36
- module = []
36
+ module = [" mlua_derive " ]
37
37
async = [" futures-core" , " futures-task" , " futures-util" ]
38
38
send = []
39
39
serialize = [" serde" , " erased-serde" ]
40
40
41
41
[dependencies ]
42
+ mlua_derive = { version = " 0.4" , optional = true , path = " mlua_derive" }
42
43
bstr = { version = " 0.2" , features = [" std" ], default_features = false }
43
44
lazy_static = { version = " 1.4" }
44
45
num-traits = { version = " 0.2.14" }
Original file line number Diff line number Diff line change @@ -105,22 +105,19 @@ crate-type = ["cdylib"]
105
105
106
106
[dependencies ]
107
107
mlua = { version = " 0.4" , features = [" lua53" , " module" ] }
108
- mlua_derive = " 0.4"
109
108
```
110
109
111
110
` lib.rs ` :
112
111
113
112
``` rust
114
- #[macro_use]
115
- extern crate mlua_derive;
116
113
use mlua :: prelude :: * ;
117
114
118
115
fn hello (_ : & Lua , name : String ) -> LuaResult <()> {
119
116
println! (" hello, {}!" , name );
120
117
Ok (())
121
118
}
122
119
123
- #[lua_module]
120
+ #[mlua :: lua_module]
124
121
fn my_module (lua : & Lua ) -> LuaResult <LuaTable > {
125
122
let exports = lua . create_table ()? ;
126
123
exports . set (" hello" , lua . create_function (hello )? )? ;
Original file line number Diff line number Diff line change @@ -17,4 +17,3 @@ vendored = ["mlua/vendored"]
17
17
18
18
[dependencies ]
19
19
mlua = { path = " ../.." , features = [" module" ] }
20
- mlua_derive = { path = " ../../mlua_derive" }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ fn used_memory(lua: &Lua, _: ()) -> LuaResult<usize> {
8
8
Ok ( lua. used_memory ( ) )
9
9
}
10
10
11
- #[ mlua_derive :: lua_module]
11
+ #[ mlua :: lua_module]
12
12
fn rust_module ( lua : & Lua ) -> LuaResult < LuaTable > {
13
13
let exports = lua. create_table ( ) ?;
14
14
exports. set ( "sum" , lua. create_function ( sum) ?) ?;
Original file line number Diff line number Diff line change @@ -115,3 +115,12 @@ pub use crate::serde::LuaSerdeExt;
115
115
pub mod prelude;
116
116
#[ cfg( feature = "serialize" ) ]
117
117
pub mod serde;
118
+
119
+ // Re-export #[mlua_derive::lua_module].
120
+ #[ cfg( feature = "mlua_derive" ) ]
121
+ #[ allow( unused_imports) ]
122
+ #[ macro_use]
123
+ extern crate mlua_derive;
124
+ #[ cfg( feature = "mlua_derive" ) ]
125
+ #[ doc( hidden) ]
126
+ pub use mlua_derive:: * ;
You can’t perform that action at this time.
0 commit comments