pub trait FromLua<'a>: Sized {
const TYPE_NAME: &'static str = _;
// Required method
fn from_lua(lua: &'a State, val: ValRef<'a>) -> Result<Self>;
}Expand description
Trait for types that can be taken from the Lua stack
For the reference types such as &[u8], &str, the conversion will fail if val not an argument passed by lua.
For the compound reference types such as Vec<&[u8]>, the conversion always fail,
because it will create some temporary ValRefs on the stack, which can not hold the reference’s lifetime.
In order to convert to reference type, you can use the ValRef::deserialize method with the serde feature enabled,
it can guarantee the lifetime of the reference type is same as &ValRef
Provided Associated Constants§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl FromLua<'_> for SocketAddr
impl FromLua<'_> for SocketAddr
Source§impl<'a, K: FromLua<'a> + Eq + Hash + 'static, V: FromLua<'a> + 'static> FromLua<'a> for HashMap<K, V>
Available on crate feature std only.
impl<'a, K: FromLua<'a> + Eq + Hash + 'static, V: FromLua<'a> + 'static> FromLua<'a> for HashMap<K, V>
Available on crate feature
std only.