Skip to main content

Module file_source

Module file_source 

Source
Expand description

Pluggable file source for Lua’s fs.read / fs.read_bytes.

Consumers (e.g. embedded-app binaries) implement FileSource to redirect the runtime’s filesystem reads through their own backing store — typically a rust-embed virtual FS plus optional disk overlays for operator config.

When no FileSource is registered, fs.read falls back to direct disk reads (preserving the standalone assay run script.lua behaviour).

Structs§

DiskFileSource
Default FileSource that reads directly from disk. Available for callers who want to register a source explicitly but keep disk-backed semantics.

Traits§

FileSource
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.

Functions§

set_file_source
Register a FileSource with the given Lua state. Subsequent calls to fs.read / fs.read_bytes consult this source instead of reading from disk directly.