Expand description
Simple File I/O Operations
Provides synchronous file read/write operations for simple use cases.
For async operations or more advanced file handling, use the fs
module with the Vfs trait.
§Features
Requires the persistence feature.
§Platform Support
- Native: Full support via
std::fs - WASM: Not available (use OPFS via the
fsmodule instead)
§Example
use logicaffeine_system::file;
// Write a file
file::write("data.txt".to_string(), "Hello, World!".to_string())?;
// Read it back
let content = file::read("data.txt".to_string())?;
assert_eq!(content, "Hello, World!");Functions§
- read
- Reads a file as a UTF-8 string.
- read_
bytes - Reads a file’s raw bytes. The total counterpart of the trapping
readBytesbuiltin. - read_
reals - Reads a file of little-endian IEEE-754 binary64 values, eight bytes a value in order: the numbers a program reads
at run time rather than carries as code (
readReals; a model’s weights). The interpreter and the AOT-Rust lowering both call this, so the read and its refusals are one. A file that is not a whole number of values is refused. - write
- Writes a string to a file.