Add #[derive(FromLua)] macro to opt-in into FromLua<T> where T: 'static + Clone (userdata type).

Future macro implementations will allow making T from Lua tables/other values.
Relates to #291.
This commit is contained in:
Alex Orlenko
2023-07-16 01:57:28 +01:00
parent 355a0606c3
commit 0e030d21b0
4 changed files with 84 additions and 0 deletions
+8
View File
@@ -216,6 +216,14 @@ pub use crate::{
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
pub use mlua_derive::chunk;
/// Derive [`FromLua`] for a Rust type.
///
/// Current implementation generate code that takes [`UserData`] value, borrow it (of the Rust type)
/// and clone.
#[cfg(feature = "macros")]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
pub use mlua_derive::FromLua;
/// Registers Lua module entrypoint.
///
/// You can register multiple entrypoints as required.