Struct oxi_types::Function

source ·
pub struct Function<A, R> { /* private fields */ }
Expand description

A wrapper around a Lua reference to a function stored in the Lua registry.

Implementations§

source§

impl<A, R> Function<A, R>

source

pub fn from_fn<F, E>(fun: F) -> Self
where F: Fn(A) -> Result<R, E> + 'static, A: Poppable, R: Pushable, E: StdError + 'static,

source

pub fn from_fn_mut<F, E>(fun: F) -> Self
where F: FnMut(A) -> Result<R, E> + 'static, A: Poppable, R: Pushable, E: StdError + 'static,

source

pub fn from_fn_once<F, E>(fun: F) -> Self
where F: FnOnce(A) -> Result<R, E> + 'static, A: Poppable, R: Pushable, E: StdError + 'static,

source

pub fn call(&self, args: A) -> Result<R, Error>
where A: Pushable, R: Poppable,

Trait Implementations§

source§

impl<A: Clone, R: Clone> Clone for Function<A, R>

source§

fn clone(&self) -> Function<A, R>

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, R> Debug for Function<A, R>

source§

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

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

impl<A, R, F, E> From<F> for Function<A, R>
where F: FnMut(A) -> Result<R, E> + 'static, A: Poppable, R: Pushable, E: StdError + 'static,

source§

fn from(fun: F) -> Function<A, R>

Converts to this type from the input type.
source§

impl<A, R> From<Function<A, R>> for Object

source§

fn from(fun: Function<A, R>) -> Self

Converts to this type from the input type.
source§

impl<A, R> FromObject for Function<A, R>

source§

impl<A: Hash, R: Hash> Hash for Function<A, R>

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: PartialEq, R: PartialEq> PartialEq for Function<A, R>

source§

fn eq(&self, other: &Function<A, R>) -> 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, R> Poppable for Function<A, R>

source§

unsafe fn pop(state: *mut lua_State) -> Result<Self, Error>

Pops the value at the top of the stack.
source§

impl<A, R> Pushable for Function<A, R>

source§

unsafe fn push(self, state: *mut lua_State) -> Result<c_int, Error>

Pushes all its values on the Lua stack, returning the number of values that it pushed.
source§

impl<A: Eq, R: Eq> Eq for Function<A, R>

source§

impl<A, R> StructuralPartialEq for Function<A, R>

Auto Trait Implementations§

§

impl<A, R> RefUnwindSafe for Function<A, R>

§

impl<A, R> Send for Function<A, R>
where A: Send, R: Send,

§

impl<A, R> Sync for Function<A, R>
where A: Sync, R: Sync,

§

impl<A, R> Unpin for Function<A, R>
where A: Unpin, R: Unpin,

§

impl<A, R> UnwindSafe for Function<A, R>
where A: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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> ToObject for T
where T: Into<Object>,

source§

impl<T> ToOwned for T
where 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 T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.