Skip to main content

Module filehandle

Module filehandle 

Source
Expand description

Minimal file-handle abstraction shared between lua-vm (hook type) and lua-stdlib (io library).

std::fs and std::io are banned in lua-stdlib by PORTING.md §1. The concrete implementation (backed by std::fs::File) lives in lua-cli and is installed via crate::error::LuaError-returning function pointers on [lua_vm::state::GlobalState]. This trait is the shared seam that allows lua-stdlib to program against file handles without importing std::fs.

§Trait design

The trait mirrors the subset of LuaFileOps (defined in lua-stdlib) that is required to run the built-in io library at the level needed for attrib.lua-class tests: sequential write, byte-by-byte read, flush, and seek. LuaFileOps in lua-stdlib extends this trait so that a single concrete type (the FsFile in lua-cli) satisfies both.

Traits§

LuaFileHandle
Capabilities required by the io library from an OS file handle.