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>
impl<A, R> Function<A, R>
pub fn from_fn<F, O>(fun: F) -> Function<A, R>where
F: Fn(A) -> O + 'static,
A: Poppable,
O: IntoResult<R>,
R: Pushable,
<O as IntoResult<R>>::Error: Error + 'static,
pub fn from_fn_mut<F, O>(fun: F) -> Function<A, R>where
F: FnMut(A) -> O + 'static,
A: Poppable,
O: IntoResult<R>,
R: Pushable,
<O as IntoResult<R>>::Error: Error + 'static,
pub fn from_fn_once<F, O>(fun: F) -> Function<A, R>where
F: FnOnce(A) -> O + 'static,
A: Poppable,
O: IntoResult<R>,
R: Pushable,
<O as IntoResult<R>>::Error: Error + 'static,
pub fn call(&self, args: A) -> Result<R, Error>
Trait Implementations§
Source§impl<'de, A, R> Deserialize<'de> for Function<A, R>
impl<'de, A, R> Deserialize<'de> for Function<A, R>
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Function<A, R>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Function<A, R>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<A, R, F, O> From<F> for Function<A, R>where
F: Fn(A) -> O + 'static,
A: Poppable,
O: IntoResult<R>,
R: Pushable,
<O as IntoResult<R>>::Error: Error + 'static,
impl<A, R, F, O> From<F> for Function<A, R>where
F: Fn(A) -> O + 'static,
A: Poppable,
O: IntoResult<R>,
R: Pushable,
<O as IntoResult<R>>::Error: Error + 'static,
Source§impl<A, R> FromObject for Function<A, R>
impl<A, R> FromObject for Function<A, R>
Source§impl<A, R> Serialize for Function<A, R>
impl<A, R> Serialize for Function<A, R>
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl<A, R> ToFunction<A, R> for Function<A, R>
impl<A, R> ToFunction<A, R> for Function<A, R>
fn into_luaref(self) -> i32
impl<A, R> Eq for Function<A, R>
impl<A, R> StructuralPartialEq for Function<A, R>
Auto Trait Implementations§
impl<A, R> Freeze for Function<A, R>
impl<A, R> RefUnwindSafe for Function<A, R>where
A: RefUnwindSafe,
R: RefUnwindSafe,
impl<A, R> Send for Function<A, R>
impl<A, R> Sync for Function<A, R>
impl<A, R> Unpin for Function<A, R>
impl<A, R> UnwindSafe for Function<A, R>where
A: UnwindSafe,
R: UnwindSafe,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§type Error = Infallible
type Error = Infallible
The error type in the returned
Result.Source§fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
Converts the value into a
Result.