pub struct LuaFunction<'a, 'b> { /* private fields */ }
Expand description

Lua function

A function inside the Lua machine can be referenced from Rust through a LuaFunction. See Function trait for information on how to use this type.

Lifetimes

Lifetime argument 'a corresponds to the lifetime argument 'a of LuaMachine. It is a lower bound for closures passed to the Lua machine.

Lifetime argument 'b corresponds to the lifetime of the shared reference to the LuaMachine being worked with.

Trait Implementations§

source§

impl<'a, 'b> Clone for LuaFunction<'a, 'b>

source§

fn clone(&self) -> LuaFunction<'a, 'b>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, 'b> Debug for LuaFunction<'a, 'b>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, 'b, 'c> From<LuaFunction<'a, 'b>> for LuaDatum<'a, 'b, 'c>

source§

fn from(value: LuaFunction<'a, 'b>) -> Self

Converts to this type from the input type.
source§

impl<'a, 'b> Function for LuaFunction<'a, 'b>

§

type Datum<'c> = LuaDatum<'a, 'b, 'c>

Type used for arguments and return values
source§

fn chunk_name(&self) -> Option<&str>

Chunk name which was used to create function (if known)
source§

fn call<'c, A>( &self, args: A ) -> Result<Vec<LuaDatum<'a, 'b, 'static>>, MachineError>where A: IntoIterator<Item = LuaDatum<'a, 'b, 'c>>, <A as IntoIterator>::IntoIter: ExactSizeIterator,

Call the function
source§

fn call_expect_retvals<'c, A>( &self, count: usize, args: A ) -> Result<Vec<Self::Datum<'static>, Global>, MachineError>where A: IntoIterator<Item = Self::Datum<'c>>, <A as IntoIterator>::IntoIter: ExactSizeIterator,

Same as Function::call but expects a fixed number of return values
source§

fn call_expect_min_retvals<'c, A>( &self, count: usize, args: A ) -> Result<Vec<Self::Datum<'static>, Global>, MachineError>where A: IntoIterator<Item = Self::Datum<'c>>, <A as IntoIterator>::IntoIter: ExactSizeIterator,

Same as Function::call but expects a minimum number of return values
source§

fn call_1ret<'c, A>( &self, args: A ) -> Result<Self::Datum<'static>, MachineError>where A: IntoIterator<Item = Self::Datum<'c>>, <A as IntoIterator>::IntoIter: ExactSizeIterator,

Same as Function::call but expects exactly one return value
source§

fn call_2ret<'c, A>( &self, args: A ) -> Result<(Self::Datum<'static>, Self::Datum<'static>), MachineError>where A: IntoIterator<Item = Self::Datum<'c>>, <A as IntoIterator>::IntoIter: ExactSizeIterator,

Same as Function::call but expects exactly two return values
source§

fn call_3ret<'c, A>( &self, args: A ) -> Result<(Self::Datum<'static>, Self::Datum<'static>, Self::Datum<'static>), MachineError>where A: IntoIterator<Item = Self::Datum<'c>>, <A as IntoIterator>::IntoIter: ExactSizeIterator,

Same as Function::call but expects exactly three return values
source§

impl<'a, 'b> Hash for LuaFunction<'a, 'b>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, 'b> PartialEq<LuaFunction<'a, 'b>> for LuaFunction<'a, 'b>

source§

fn eq(&self, other: &LuaFunction<'a, 'b>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> Eq for LuaFunction<'a, 'b>

source§

impl<'a, 'b> StructuralEq for LuaFunction<'a, 'b>

source§

impl<'a, 'b> StructuralPartialEq for LuaFunction<'a, 'b>

Auto Trait Implementations§

§

impl<'a, 'b> RefUnwindSafe for LuaFunction<'a, 'b>

§

impl<'a, 'b> !Send for LuaFunction<'a, 'b>

§

impl<'a, 'b> !Sync for LuaFunction<'a, 'b>

§

impl<'a, 'b> Unpin for LuaFunction<'a, 'b>

§

impl<'a, 'b> UnwindSafe for LuaFunction<'a, 'b>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.