pub struct UserData<A, T: ?Sized> { /* private fields */ }Expand description
Lua full userdata.
Use Lua::create_ud() or Context::create_ud() to create the value of this type.
§Types that implement [PropertyKey]
You can pass a value of the following types for property name:
- Reference to str.
Implementations§
Source§impl<A, T: ?Sized> UserData<A, T>
impl<A, T: ?Sized> UserData<A, T>
Sourcepub fn get<K: PropertyKey>(&self, name: K) -> Value<'_, A>
pub fn get<K: PropertyKey>(&self, name: K) -> Value<'_, A>
Gets a property of this userdata.
See UserData for a list of supported value on name.
Sourcepub fn set<K: PropertyKey>(&self, name: K, value: impl Into<UnsafeValue<A>>)
pub fn set<K: PropertyKey>(&self, name: K, value: impl Into<UnsafeValue<A>>)
Sets a property of this userdata.
Once this method is called the index operation on this userdata no longer report an error
even if this userdata does not have a metatable or no __index on its metatable.
See UserData for a list of supported value on name.
§Panics
If value was created from different Lua instance.
Auto Trait Implementations§
impl<A, T> !Freeze for UserData<A, T>
impl<A, T> !RefUnwindSafe for UserData<A, T>
impl<A, T> !Send for UserData<A, T>
impl<A, T> !Sync for UserData<A, T>
impl<A, T> !Unpin for UserData<A, T>
impl<A, T> !UnwindSafe for UserData<A, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more