pub struct AnyUserData { /* private fields */ }Expand description
A handle to an arbitrary Lua userdata value.
Mirrors mlua::AnyUserData. Supports construction, use-from-Lua, and typed
Rust-side borrowing (borrow /
borrow_mut / take /
is).
Implementations§
Source§impl AnyUserData
impl AnyUserData
Sourcepub fn to_pointer(&self) -> *const c_void
pub fn to_pointer(&self) -> *const c_void
A raw pointer identifying this userdata. Mirrors
mlua::AnyUserData::to_pointer.
Sourcepub fn equals(&self, other: &AnyUserData) -> Result<bool, Error>
pub fn equals(&self, other: &AnyUserData) -> Result<bool, Error>
Compare for equality honoring an __eq metamethod.
Mirrors mlua::AnyUserData::equals.
Sourcepub fn is<T>(&self) -> boolwhere
T: 'static,
pub fn is<T>(&self) -> boolwhere
T: 'static,
Whether the stored value is of concrete type T. Mirrors
mlua::AnyUserData::is. Returns false after the value has been taken.
Sourcepub fn type_id(&self) -> Option<TypeId>
pub fn type_id(&self) -> Option<TypeId>
The TypeId of the stored value, if it is a luaur-rt userdata.
Mirrors mlua::AnyUserData::type_id (here it returns the concrete
TypeId whenever the userdata carries a luaur-rt wrapper header).
Sourcepub fn borrow<T>(&self) -> Result<UserDataRef<'_, T>, Error>where
T: 'static,
pub fn borrow<T>(&self) -> Result<UserDataRef<'_, T>, Error>where
T: 'static,
Immutably borrow the stored value as T. Mirrors
mlua::AnyUserData::borrow. Errors with Error::UserDataTypeMismatch
on a type mismatch, Error::UserDataDestructed if it was taken, or
Error::UserDataBorrowError if already mutably borrowed.
Sourcepub fn borrow_mut<T>(&self) -> Result<UserDataRefMut<'_, T>, Error>where
T: 'static,
pub fn borrow_mut<T>(&self) -> Result<UserDataRefMut<'_, T>, Error>where
T: 'static,
Mutably borrow the stored value as T. Mirrors
mlua::AnyUserData::borrow_mut.
Sourcepub fn take<T>(&self) -> Result<T, Error>where
T: 'static,
pub fn take<T>(&self) -> Result<T, Error>where
T: 'static,
Take the stored value out of the userdata, leaving it destructed.
Mirrors mlua::AnyUserData::take. Errors with
Error::UserDataBorrowMutError if currently borrowed, or
Error::UserDataDestructed if already taken.
Trait Implementations§
Source§impl Clone for AnyUserData
impl Clone for AnyUserData
Source§fn clone(&self) -> AnyUserData
fn clone(&self) -> AnyUserData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more