Trait mlua::AsChunk

source ·
pub trait AsChunk<'lua, 'a> {
    // Required method
    fn source(self) -> IoResult<Cow<'a, [u8]>>;

    // Provided methods
    fn name(&self) -> Option<StdString> { ... }
    fn environment(&self, lua: &'lua Lua) -> Result<Option<Table<'lua>>> { ... }
    fn mode(&self) -> Option<ChunkMode> { ... }
}
Expand description

Trait for types loadable by Lua and convertible to a Chunk

Required Methods§

source

fn source(self) -> IoResult<Cow<'a, [u8]>>

Returns chunk data (can be text or binary)

Provided Methods§

source

fn name(&self) -> Option<StdString>

Returns optional chunk name

source

fn environment(&self, lua: &'lua Lua) -> Result<Option<Table<'lua>>>

Returns optional chunk environment

source

fn mode(&self) -> Option<ChunkMode>

Returns optional chunk mode (text or binary)

Implementations on Foreign Types§

source§

impl<'a> AsChunk<'_, 'a> for &'a [u8]

source§

fn source(self) -> IoResult<Cow<'a, [u8]>>

source§

impl AsChunk<'_, 'static> for Vec<u8>

source§

fn source(self) -> IoResult<Cow<'static, [u8]>>

source§

impl AsChunk<'_, 'static> for String

source§

fn source(self) -> IoResult<Cow<'static, [u8]>>

source§

impl AsChunk<'_, 'static> for PathBuf

source§

fn name(&self) -> Option<StdString>

source§

fn source(self) -> IoResult<Cow<'static, [u8]>>

source§

impl<'a> AsChunk<'_, 'a> for &'a Vec<u8>

source§

fn source(self) -> IoResult<Cow<'a, [u8]>>

source§

impl<'a> AsChunk<'_, 'a> for &'a String

source§

fn source(self) -> IoResult<Cow<'a, [u8]>>

source§

impl<'a> AsChunk<'_, 'a> for &'a str

source§

fn source(self) -> IoResult<Cow<'a, [u8]>>

source§

impl AsChunk<'_, 'static> for &Path

source§

fn name(&self) -> Option<StdString>

source§

fn source(self) -> IoResult<Cow<'static, [u8]>>

Implementors§