Skip to main content

Chunk

Struct Chunk 

Source
pub struct Chunk<'lua> { /* private fields */ }
Expand description

Builder returned by Lua::load, similar to mlua::Chunk.

Implementations§

Source§

impl<'lua> Chunk<'lua>

Source

pub fn set_name(self, name: impl Into<String>) -> Self

Set a chunk name used in diagnostics.

Source

pub fn into_function(self) -> LuaResult<Function>

Compile the chunk and return it as a callable function handle.

Source

pub fn exec(self) -> LuaResult<()>

Execute the chunk and discard returned values.

Source

pub async fn exec_async(self) -> LuaResult<()>

Execute the chunk asynchronously and discard returned values.

Source

pub fn eval<R: FromLua>(self) -> LuaResult<R>

Execute the chunk and convert the first return value.

Source

pub async fn eval_async<R: FromLua>(self) -> LuaResult<R>

Execute the chunk asynchronously and convert the first return value.

Source

pub fn eval_multi<R: FromLuaMulti>(self) -> LuaResult<R>

Execute the chunk and convert all returned values.

Source

pub async fn eval_multi_async<R: FromLuaMulti>(self) -> LuaResult<R>

Execute the chunk asynchronously and convert all returned values.

Source

pub fn call<A: IntoLua, R: FromLuaMulti>(self, args: A) -> LuaResult<R>

Compile the chunk and call it with Rust arguments.

Source

pub async fn call_async<A: IntoLua, R: FromLuaMulti>( self, args: A, ) -> LuaResult<R>

Compile the chunk and call it asynchronously with Rust arguments.

Source

pub fn call1<A: IntoLua, R: FromLua>(self, args: A) -> LuaResult<R>

Compile the chunk and call it, converting only the first return value.

Source

pub async fn call1_async<A: IntoLua, R: FromLua>(self, args: A) -> LuaResult<R>

Compile the chunk and call it asynchronously, converting only the first return value.

Auto Trait Implementations§

§

impl<'lua> Freeze for Chunk<'lua>

§

impl<'lua> !RefUnwindSafe for Chunk<'lua>

§

impl<'lua> !Send for Chunk<'lua>

§

impl<'lua> !Sync for Chunk<'lua>

§

impl<'lua> Unpin for Chunk<'lua>

§

impl<'lua> UnsafeUnpin for Chunk<'lua>

§

impl<'lua> !UnwindSafe for Chunk<'lua>

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> LuaMethodProvider for T

Source§

impl<T> LuaStaticMethodProvider for T

Source§

fn __lua_static_methods() -> &'static [(&'static str, CFunction)]

Source§

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

Source§

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>,

Source§

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.