Struct mlua::OwnedAnyUserData
source · pub struct OwnedAnyUserData(/* private fields */);
Expand description
Owned handle to an internal Lua userdata.
The owned handle holds a strong reference to the current Lua instance.
Be warned, if you place it into a Lua type (eg. UserData
or a Rust callback), it is very easy
to accidentally cause reference cycles that would prevent destroying Lua instance.
Implementations§
source§impl OwnedAnyUserData
impl OwnedAnyUserData
sourcepub const fn to_ref(&self) -> AnyUserData<'_>
pub const fn to_ref(&self) -> AnyUserData<'_>
Get borrowed handle to the underlying Lua userdata.
source§impl OwnedAnyUserData
impl OwnedAnyUserData
sourcepub fn borrow<T: 'static>(&self) -> Result<Ref<'_, T>>
pub fn borrow<T: 'static>(&self) -> Result<Ref<'_, T>>
Borrow this userdata immutably if it is of type T
.
This is a shortcut for AnyUserData::borrow()
sourcepub fn borrow_mut<T: 'static>(&self) -> Result<RefMut<'_, T>>
pub fn borrow_mut<T: 'static>(&self) -> Result<RefMut<'_, T>>
Borrow this userdata mutably if it is of type T
.
This is a shortcut for AnyUserData::borrow_mut()
sourcepub fn take<T: 'static>(&self) -> Result<T>
pub fn take<T: 'static>(&self) -> Result<T>
Takes the value out of this userdata.
This is a shortcut for AnyUserData::take()
Trait Implementations§
source§impl Clone for OwnedAnyUserData
impl Clone for OwnedAnyUserData
source§fn clone(&self) -> OwnedAnyUserData
fn clone(&self) -> OwnedAnyUserData
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for OwnedAnyUserData
impl Debug for OwnedAnyUserData
source§impl<'lua> FromLua<'lua> for OwnedAnyUserData
Available on crate feature unstable
and non-crate feature send
only.
impl<'lua> FromLua<'lua> for OwnedAnyUserData
Available on crate feature
unstable
and non-crate feature send
only.source§impl<'lua> IntoLua<'lua> for &OwnedAnyUserData
Available on crate feature unstable
and non-crate feature send
only.
impl<'lua> IntoLua<'lua> for &OwnedAnyUserData
Available on crate feature
unstable
and non-crate feature send
only.Auto Trait Implementations§
impl Freeze for OwnedAnyUserData
impl !RefUnwindSafe for OwnedAnyUserData
impl !Send for OwnedAnyUserData
impl !Sync for OwnedAnyUserData
impl Unpin for OwnedAnyUserData
impl !UnwindSafe for OwnedAnyUserData
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
source§impl<'lua, T> FromLuaMulti<'lua> for Twhere
T: FromLua<'lua>,
impl<'lua, T> FromLuaMulti<'lua> for Twhere
T: FromLua<'lua>,
source§fn from_lua_multi(values: MultiValue<'lua>, lua: &'lua Lua) -> Result<T, Error>
fn from_lua_multi(values: MultiValue<'lua>, lua: &'lua Lua) -> Result<T, Error>
Performs the conversion. Read more
fn from_lua_args( args: MultiValue<'lua>, i: usize, to: Option<&str>, lua: &'lua Lua ) -> Result<T, Error>
unsafe fn from_stack_multi(nvals: i32, lua: &'lua Lua) -> Result<T, Error>
unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &'lua Lua ) -> Result<T, Error>
source§impl<'lua, T> IntoLuaMulti<'lua> for Twhere
T: IntoLua<'lua>,
impl<'lua, T> IntoLuaMulti<'lua> for Twhere
T: IntoLua<'lua>,
source§fn into_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error>
fn into_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error>
Performs the conversion.