Struct mlua::UserDataMetatable [−][src]
pub struct UserDataMetatable<'lua>(_);
Expand description
Handle to a UserData
metatable.
Implementations
impl<'lua> UserDataMetatable<'lua>
[src]
impl<'lua> UserDataMetatable<'lua>
[src]pub fn get<K: Into<MetaMethod>, V: FromLua<'lua>>(&self, key: K) -> Result<V>
[src]
pub fn get<K: Into<MetaMethod>, V: FromLua<'lua>>(&self, key: K) -> Result<V>
[src]Gets the value associated to key
from the metatable.
If no value is associated to key
, returns the Nil
value.
Access to restricted metamethods such as __gc
or __metatable
will cause an error.
pub fn set<K: Into<MetaMethod>, V: ToLua<'lua>>(
&self,
key: K,
value: V
) -> Result<()>
[src]
pub fn set<K: Into<MetaMethod>, V: ToLua<'lua>>(
&self,
key: K,
value: V
) -> Result<()>
[src]Sets a key-value pair in the metatable.
If the value is Nil
, this will effectively remove the key
.
Access to restricted metamethods such as __gc
or __metatable
will cause an error.
Setting __index
or __newindex
metamethods is also restricted because their values are cached
for mlua
internal usage.
Trait Implementations
impl<'lua> Clone for UserDataMetatable<'lua>
[src]
impl<'lua> Clone for UserDataMetatable<'lua>
[src]fn clone(&self) -> UserDataMetatable<'lua>
[src]
fn clone(&self) -> UserDataMetatable<'lua>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<'lua> !RefUnwindSafe for UserDataMetatable<'lua>
impl<'lua> !Send for UserDataMetatable<'lua>
impl<'lua> !Sync for UserDataMetatable<'lua>
impl<'lua> Unpin for UserDataMetatable<'lua>
impl<'lua> !UnwindSafe for UserDataMetatable<'lua>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more