Skip to main content

FromLua

Trait FromLua 

Source
pub trait FromLua: Sized {
    // Required method
    fn from_lua(value: LuaValue, state: &LuaState) -> Result<Self, String>;
}
Expand description

Convert a LuaValue into a Rust type.

Implementors define how a Lua value is converted to Self. Return Err(message) for type mismatches.

Required Methods§

Source

fn from_lua(value: LuaValue, state: &LuaState) -> Result<Self, String>

Convert a LuaValue to Self.

state is provided for operations that need GC access (e.g. string interning).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromLua for bool

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for f32

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for f64

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for i8

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for i16

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for i32

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for i64

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for isize

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for u8

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for u16

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for u32

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for u64

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for ()

Source§

fn from_lua(_value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for usize

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl FromLua for String

Source§

fn from_lua(value: LuaValue, _state: &LuaState) -> Result<Self, String>

Source§

impl<T: FromLua> FromLua for Option<T>

Source§

fn from_lua(value: LuaValue, state: &LuaState) -> Result<Self, String>

Implementors§