ObjectLike

Trait ObjectLike 

Source
pub trait ObjectLike: Sealed {
    // Required methods
    fn get<V: FromLua>(&self, state: &State, key: impl ToLua) -> Result<V>;
    fn set(
        &self,
        state: &State,
        key: impl ToLua,
        value: impl ToLua,
    ) -> Result<()>;
    fn call<R: FromLuaMulti>(
        &self,
        state: &State,
        name: &str,
        args: impl ToLuaMulti,
    ) -> Result<R>;
    fn call_method<R: FromLuaMulti>(
        &self,
        state: &State,
        name: &str,
        args: impl ToLuaMulti,
    ) -> Result<R>;
}

Required Methods§

Source

fn get<V: FromLua>(&self, state: &State, key: impl ToLua) -> Result<V>

Gets the value associated to key from the object, assuming it has __index metamethod.

Source

fn set(&self, state: &State, key: impl ToLua, value: impl ToLua) -> Result<()>

Sets the value associated to key in the object, assuming it has __newindex metamethod.

Source

fn call<R: FromLuaMulti>( &self, state: &State, name: &str, args: impl ToLuaMulti, ) -> Result<R>

Gets the function associated to key name from the object and calls it, passing args as function arguments.

This might invoke the __index metamethod.

Source

fn call_method<R: FromLuaMulti>( &self, state: &State, name: &str, args: impl ToLuaMulti, ) -> Result<R>

Gets the function associated to key name from the object and calls it, passing the object itself along with args as function arguments.

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.

Implementors§