Xen / reference v0.1.0-demo.2
std.fs
This topic is not available in the selected language or version. Showing the start of this section.
APIs documented for this release.
use std.fs;| API | Return value |
|---|---|
std.fs.read(path: String) | Result<String, IoError>; read the whole file |
std.fs.write(path: String, contents: String) | Result<Int, IoError>; create or overwrite, returning bytes written |
std.fs.append(path: String, contents: String) | Result<Int, IoError>; append, creating if absent |
std.fs.copy(source: String, destination: String) | Result<Int, IoError>; read the whole source and overwrite the destination |
std.fs.metadata(path: String) | Result<std.fs.Metadata, IoError> |
std.fs.read_dir(path: String) | Result<Vec<String>, IoError>; immediate entry names |
Writing APIs change files. write and copy overwrite destination contents. read and copy hold entire files in memory. Paths cannot contain NUL bytes.
Metadata has size: Int, modified_seconds: Int, is_file: Bool, and is_directory: Bool. Modification time is seconds since the Unix epoch. Metadata follows symbolic links. read_dir does not recurse, excludes . and .., and has unspecified ordering.