pub struct TypedFunction<'lua, Params, Response>where
Params: TypedMultiValue,
Response: TypedMultiValue,{ /* private fields */ }
Expand description
Implementations§
Source§impl<'lua, Params, Response> TypedFunction<'lua, Params, Response>
impl<'lua, Params, Response> TypedFunction<'lua, Params, Response>
Sourcepub fn call(&self, params: Params) -> Result<Response>
pub fn call(&self, params: Params) -> Result<Response>
Same as Function::call but with the param and return types already specified
Sourcepub unsafe fn call_unsafe(&self, params: Params) -> Response
pub unsafe fn call_unsafe(&self, params: Params) -> Response
Same as Function::call but with the param and return types already specified
§Safety
Panics if any lua errors occur
Sourcepub fn from_rust<F>(&self, lua: &'lua Lua, func: F) -> Result<Self>where
Params: TypedMultiValue + FromLuaMulti<'lua>,
Response: TypedMultiValue + IntoLuaMulti<'lua>,
F: Fn(&'lua Lua, Params) -> Result<Response> + MaybeSend + 'static,
pub fn from_rust<F>(&self, lua: &'lua Lua, func: F) -> Result<Self>where
Params: TypedMultiValue + FromLuaMulti<'lua>,
Response: TypedMultiValue + IntoLuaMulti<'lua>,
F: Fn(&'lua Lua, Params) -> Result<Response> + MaybeSend + 'static,
Create a typed function from a rust function.
This will call Lua::create_function
under the hood
Trait Implementations§
Source§impl<'lua, Params, Response> FromLua<'lua> for TypedFunction<'lua, Params, Response>where
Params: TypedMultiValue,
Response: TypedMultiValue,
impl<'lua, Params, Response> FromLua<'lua> for TypedFunction<'lua, Params, Response>where
Params: TypedMultiValue,
Response: TypedMultiValue,
Source§impl<'lua, Params, Response> IntoLua<'lua> for TypedFunction<'lua, Params, Response>where
Params: TypedMultiValue,
Response: TypedMultiValue,
impl<'lua, Params, Response> IntoLua<'lua> for TypedFunction<'lua, Params, Response>where
Params: TypedMultiValue,
Response: TypedMultiValue,
Source§impl<'lua, Params, Response> Typed for TypedFunction<'lua, Params, Response>where
Params: TypedMultiValue,
Response: TypedMultiValue,
impl<'lua, Params, Response> Typed for TypedFunction<'lua, Params, Response>where
Params: TypedMultiValue,
Response: TypedMultiValue,
Auto Trait Implementations§
impl<'lua, Params, Response> Freeze for TypedFunction<'lua, Params, Response>
impl<'lua, Params, Response> !RefUnwindSafe for TypedFunction<'lua, Params, Response>
impl<'lua, Params, Response> !Send for TypedFunction<'lua, Params, Response>
impl<'lua, Params, Response> !Sync for TypedFunction<'lua, Params, Response>
impl<'lua, Params, Response> Unpin for TypedFunction<'lua, Params, Response>
impl<'lua, Params, Response> !UnwindSafe for TypedFunction<'lua, Params, Response>
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.