Skip to main content

FileSource

Trait FileSource 

Source
pub trait FileSource: Send + Sync {
    // Required method
    fn read(&self, path: &str) -> Option<Vec<u8>>;
}
Expand description

Anything that can resolve a path string to bytes. Implementations MUST be cheap to clone (we hold Arc<dyn FileSource>) and Send + Sync so they can live in mlua’s app-data across async tasks.

Required Methods§

Source

fn read(&self, path: &str) -> Option<Vec<u8>>

Return the bytes at path, or None if the path is unknown. Errors during read are surfaced as None; this matches Lua’s existing “missing file” behaviour where fs.read raises a runtime error.

Implementors§