pub struct LStream {
pub file: Option<Box<dyn LuaFileHandle>>,
pub close_fn: Option<fn(&mut LuaState) -> Result<usize, LuaError>>,
}Expand description
A Lua file handle. C equivalent: typedef luaL_Stream LStream.
The instance lives in LSTREAM_REGISTRY (keyed by its userdata’s identity),
wrapped in Rc<RefCell<…>> so a brief file borrow and a LuaState borrow
never overlap — the safe-Rust resolution of C’s single LStream * pointer.
Fields§
§file: Option<Box<dyn LuaFileHandle>>OS file handle. None = incompletely opened (the pre-file pattern).
Concrete implementations are installed via GlobalState::file_open_hook
(registered by lua-cli) to keep std::fs out of lua-stdlib.
close_fn: Option<fn(&mut LuaState) -> Result<usize, LuaError>>Close callback. None means the stream is closed. C: p->closef == NULL.
Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LStream
impl !Sync for LStream
impl !UnwindSafe for LStream
impl Freeze for LStream
impl Send for LStream
impl Unpin for LStream
impl UnsafeUnpin for LStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more