Struct tlua::IndexableRW
source · [−]pub struct IndexableRW<L> { /* private fields */ }
Expand description
An opaque value on lua stack that can be indexed immutably as well as
mutably. Can represent a lua table, a lua table with a __index
and
__newindex
metamethods or other indexable lua value.
Use this type when reading return values from lua functions or getting lua function from tables.
Trait Implementations
sourceimpl<L> AsLua for IndexableRW<L> where
L: AsLua,
impl<L> AsLua for IndexableRW<L> where
L: AsLua,
fn as_lua(&self) -> LuaState
sourcefn try_push<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushInto<Self>,
fn try_push<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushInto<Self>,
Try to push v
onto the lua stack. Read more
sourcefn push<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
fn push<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
Push v
onto the lua stack. Read more
sourcefn try_push_one<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushOneInto<Self>,
fn try_push_one<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushOneInto<Self>,
Try to push v
onto the lua stack. Read more
sourcefn push_one<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushOneInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
fn push_one<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushOneInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
Push v
onto the lua stack. Read more
sourcefn push_iter<I>(self, iterator: I) -> Result<PushGuard<Self>, Self> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
<<I as Iterator>::Item as PushInto<LuaState>>::Err: Into<Void>,
fn push_iter<I>(self, iterator: I) -> Result<PushGuard<Self>, Self> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
<<I as Iterator>::Item as PushInto<LuaState>>::Err: Into<Void>,
Push iterator
onto the lua stack as a lua table. Read more
sourcefn try_push_iter<I>(
self,
iterator: I
) -> Result<PushGuard<Self>, (PushIterErrorOf<I>, Self)> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
fn try_push_iter<I>(
self,
iterator: I
) -> Result<PushGuard<Self>, (PushIterErrorOf<I>, Self)> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
Push iterator
onto the lua stack as a lua table. Read more
fn read<T>(self) -> Result<T, Self> where
Self: Sized,
T: LuaRead<Self>,
fn read_at<T>(self, index: i32) -> Result<T, Self> where
Self: Sized,
T: LuaRead<Self>,
fn read_at_nz<T>(self, index: NonZeroI32) -> Result<T, Self> where
Self: Sized,
T: LuaRead<Self>,
sourceimpl<L> AsRef<Object<L>> for IndexableRW<L>
impl<L> AsRef<Object<L>> for IndexableRW<L>
sourceimpl<L: Debug> Debug for IndexableRW<L>
impl<L: Debug> Debug for IndexableRW<L>
sourceimpl<L> From<IndexableRW<L>> for Object<L> where
L: AsLua,
impl<L> From<IndexableRW<L>> for Object<L> where
L: AsLua,
sourcefn from(o: IndexableRW<L>) -> Self
fn from(o: IndexableRW<L>) -> Self
Converts to this type from the input type.
sourceimpl<L> Index<L> for IndexableRW<L> where
L: AsLua,
impl<L> Index<L> for IndexableRW<L> where
L: AsLua,
sourcefn get<'lua, K, R>(&'lua self, key: K) -> Option<R> where
L: 'lua,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<&'lua L>>,
fn get<'lua, K, R>(&'lua self, key: K) -> Option<R> where
L: 'lua,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<&'lua L>>,
Loads a value from the table (or other object using the __index
metamethod) given its index
. Read more
sourcefn try_get<'lua, K, R>(&'lua self, key: K) -> Result<R, LuaError> where
L: 'lua,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<&'lua L>>,
fn try_get<'lua, K, R>(&'lua self, key: K) -> Result<R, LuaError> where
L: 'lua,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<&'lua L>>,
Loads a value from the table (or other object using the __index
metamethod) given its index
. Read more
sourcefn into_get<K, R>(self, key: K) -> Result<R, Self> where
Self: AsLua + Sized,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<Self>>,
fn into_get<K, R>(self, key: K) -> Result<R, Self> where
Self: AsLua + Sized,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<Self>>,
Loads a value in the table (or other object using the __index
metamethod) given its index
, with the result capturing the table by
value. Read more
sourcefn try_into_get<K, R>(self, key: K) -> Result<R, (Self, LuaError)> where
Self: AsLua + Sized,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<Self>>,
fn try_into_get<K, R>(self, key: K) -> Result<R, (Self, LuaError)> where
Self: AsLua + Sized,
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
R: LuaRead<PushGuard<Self>>,
Loads a value in the table (or other object using the __index
metamethod) given its index
, with the result capturing the table by
value. Read more
sourcefn call_method<'lua, A, R>(
&'lua self,
name: &str,
args: A
) -> Result<R, MethodCallError<A::Err>> where
L: 'lua,
Self: Push<LuaState>,
Self::Err: Into<Void>,
A: PushInto<LuaState>,
R: LuaRead<PushGuard<Callable<PushGuard<&'lua L>>>>,
fn call_method<'lua, A, R>(
&'lua self,
name: &str,
args: A
) -> Result<R, MethodCallError<A::Err>> where
L: 'lua,
Self: Push<LuaState>,
Self::Err: Into<Void>,
A: PushInto<LuaState>,
R: LuaRead<PushGuard<Callable<PushGuard<&'lua L>>>>,
Calls the method called name
of the table (or other indexable object)
with the provided args
. Read more
sourceimpl<L> LuaRead<L> for IndexableRW<L> where
L: AsLua,
impl<L> LuaRead<L> for IndexableRW<L> where
L: AsLua,
sourcefn lua_read_at_position(lua: L, index: NonZeroI32) -> Result<Self, L>
fn lua_read_at_position(lua: L, index: NonZeroI32) -> Result<Self, L>
Reads the data from Lua at a given position.
fn n_values_expected() -> i32
fn lua_read_at_maybe_zero_position(lua: L, index: i32) -> Result<Self, L>
sourceimpl<L> NewIndex<L> for IndexableRW<L> where
L: AsLua,
impl<L> NewIndex<L> for IndexableRW<L> where
L: AsLua,
sourcefn set<K, V>(&self, key: K, value: V) where
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
V: PushOneInto<LuaState>,
V::Err: Into<Void>,
fn set<K, V>(&self, key: K, value: V) where
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
V: PushOneInto<LuaState>,
V::Err: Into<Void>,
Inserts or modifies a value
of the table (or other object using the
__index
or __newindex
metamethod) given its index
. Read more
sourcefn try_set<K, V>(&self, key: K, value: V) -> Result<(), LuaError> where
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
V: PushOneInto<LuaState>,
V::Err: Into<Void>,
fn try_set<K, V>(&self, key: K, value: V) -> Result<(), LuaError> where
K: PushOneInto<LuaState>,
K::Err: Into<Void>,
V: PushOneInto<LuaState>,
V::Err: Into<Void>,
Inserts or modifies a value
of the table (or other object using the
__index
or __newindex
metamethod) given its index
. Read more
sourcefn checked_set<K, V>(
&self,
key: K,
value: V
) -> Result<(), CheckedSetError<K::Err, V::Err>> where
K: PushOneInto<LuaState>,
V: PushOneInto<LuaState>,
fn checked_set<K, V>(
&self,
key: K,
value: V
) -> Result<(), CheckedSetError<K::Err, V::Err>> where
K: PushOneInto<LuaState>,
V: PushOneInto<LuaState>,
Inserts or modifies a value
of the table (or other object using the
__newindex
metamethod) given its index
. Read more
sourcefn try_checked_set<K, V>(
&self,
key: K,
value: V
) -> Result<(), Result<CheckedSetError<K::Err, V::Err>, LuaError>> where
K: PushOneInto<LuaState>,
V: PushOneInto<LuaState>,
fn try_checked_set<K, V>(
&self,
key: K,
value: V
) -> Result<(), Result<CheckedSetError<K::Err, V::Err>, LuaError>> where
K: PushOneInto<LuaState>,
V: PushOneInto<LuaState>,
Inserts or modifies a value
of the table (or other object using the
__newindex
metamethod) given its index
. Read more
sourceimpl<L, T> Push<L> for IndexableRW<T> where
L: AsLua,
impl<L, T> Push<L> for IndexableRW<T> where
L: AsLua,
sourcefn push_to_lua(&self, lua: L) -> PushResult<L, Self>
fn push_to_lua(&self, lua: L) -> PushResult<L, Self>
Pushes the value on the top of the stack. Read more
sourceimpl<L> TryFrom<Object<L>> for IndexableRW<L> where
L: AsLua,
impl<L> TryFrom<Object<L>> for IndexableRW<L> where
L: AsLua,
impl<L, T> PushOne<L> for IndexableRW<T> where
L: AsLua,
Auto Trait Implementations
impl<L> RefUnwindSafe for IndexableRW<L> where
L: RefUnwindSafe,
impl<L> Send for IndexableRW<L> where
L: Send,
impl<L> Sync for IndexableRW<L> where
L: Sync,
impl<L> Unpin for IndexableRW<L> where
L: Unpin,
impl<L> UnwindSafe for IndexableRW<L> where
L: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more