Trait AsChunk

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

    // Provided methods
    fn name(&self) -> Option<StdString> { ... }
    fn environment(&self, lua: &Lua) -> Result<Option<Table>> { ... }
    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) -> Result<Option<Table>>

Returns optional chunk environment

Source

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

Returns optional chunk mode (text or binary)

Implementations on Foreign Types§

Source§

impl AsChunk<'static> for &Path

Source§

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

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 Vec<u8>

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 str

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 Vec<u8>

Source§

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

Source§

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

Source§

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

Implementors§