pub struct LStream {
pub file: Option<Box<dyn LuaFileHandle>>,
pub close_fn: Option<fn(&mut LuaState) -> Result<usize, LuaError>>,
}Expand description
Lua file handle stored as the typed payload of a LuaUserData.
C equivalent: typedef luaL_Stream LStream in liolib.c.
TODO(port): Phase B must arrange for LStream to live inside
LuaUserData’s opaque payload. The userdata system needs a typed-access
API, e.g. state.check_arg_typed_userdata::<LStream>(1, LUA_FILE_HANDLE)?.
TODO(port): file must be Option<RefCell<Box<dyn LuaFileOps>>> to allow
interior-mutability borrow splitting between the file handle and LuaState.
Fields§
§file: Option<Box<dyn LuaFileHandle>>OS file handle. None = incompletely opened (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 Freeze for LStream
impl !RefUnwindSafe for LStream
impl Send for LStream
impl !Sync for LStream
impl Unpin for LStream
impl UnsafeUnpin for LStream
impl !UnwindSafe 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