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>
pub fn equals(&self, other: &AnyUserData) -> Result<bool>
Compare for equality honoring an __eq metamethod.
Mirrors mlua::AnyUserData::equals.
Sourcepub fn is<T: 'static>(&self) -> bool
pub fn is<T: 'static>(&self) -> bool
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: 'static>(&self) -> Result<UserDataRef<'_, T>>
pub fn borrow<T: 'static>(&self) -> Result<UserDataRef<'_, T>>
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: 'static>(&self) -> Result<UserDataRefMut<'_, T>>
pub fn borrow_mut<T: 'static>(&self) -> Result<UserDataRefMut<'_, T>>
Mutably borrow the stored value as T. Mirrors
mlua::AnyUserData::borrow_mut.
Sourcepub fn take<T: 'static>(&self) -> Result<T>
pub fn take<T: 'static>(&self) -> Result<T>
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 moreSource§impl Debug for AnyUserData
impl Debug for AnyUserData
Source§impl FromLua for AnyUserData
impl FromLua for AnyUserData
Source§fn from_lua_arg(
arg: Value,
_i: usize,
_to: Option<&str>,
lua: &Lua,
) -> Result<Self>
fn from_lua_arg( arg: Value, _i: usize, _to: Option<&str>, lua: &Lua, ) -> Result<Self>
i. The default forwards to
FromLua::from_lua; specific impls can produce nicer messages.
Mirrors mlua::FromLua::from_lua_arg.