Struct mlua::OwnedFunction
source · pub struct OwnedFunction(_);
Available on crate feature
unstable
only.Expand description
Owned handle to an internal Lua function.
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 OwnedFunction
impl OwnedFunction
source§impl OwnedFunction
impl OwnedFunction
sourcepub fn call<'lua, A, R>(&'lua self, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>,
pub fn call<'lua, A, R>(&'lua self, args: A) -> Result<R>where A: IntoLuaMulti<'lua>, R: FromLuaMulti<'lua>,
Calls the function, passing args
as function arguments.
This is a shortcut for Function::call()
.
sourcepub async fn call_async<'lua, A, R>(&'lua self, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua,
Available on crate feature async
only.
pub async fn call_async<'lua, A, R>(&'lua self, args: A) -> Result<R>where A: IntoLuaMulti<'lua>, R: FromLuaMulti<'lua> + 'lua,
async
only.Returns a future that, when polled, calls self
, passing args
as function arguments,
and drives the execution.
This is a shortcut for Function::call_async()
.
Trait Implementations§
source§impl Clone for OwnedFunction
impl Clone for OwnedFunction
source§fn clone(&self) -> OwnedFunction
fn clone(&self) -> OwnedFunction
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 OwnedFunction
impl Debug for OwnedFunction
source§impl<'lua> FromLua<'lua> for OwnedFunction
Available on non-crate feature send
only.
impl<'lua> FromLua<'lua> for OwnedFunction
Available on non-crate feature
send
only.Auto Trait Implementations§
impl !RefUnwindSafe for OwnedFunction
impl !Send for OwnedFunction
impl !Sync for OwnedFunction
impl Unpin for OwnedFunction
impl !UnwindSafe for OwnedFunction
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_multi_args( values: MultiValue<'lua>, 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.