Module fs

Source
Expand description

Filesystem manipulation operations.

This module contains basic methods to manipulate the contents of the brain’s micro SDCard. All methods in this module represent VEXos filesystem operations.

§VEXos Limitations

While this module largely mimicks Rust’s std::fs API, there are several major limitations in the VEXos filesystem. This module only provides a small subset of what would normally be expected in a typical Rust enviornment. Notably:

  • Files cannot be opened as read and write at the same time (only one). To read a file that you’ve written to, you’ll need to drop your written file descriptor and reopen it as readonly.
  • Files can be created, but not deleted or renamed.
  • Directories cannot be created or enumerated from the Brain, only top-level files.

Structs§

DirEntry
An entry returned by the ReadDir iterator.
Display
A type that allows safely displaying FsStrs that may contain non-UTF-8 data.
File
Represents a file in the file system.
FileType
A structure representing a type of file with accessors for each file type. It is returned by Metadata::file_type method.
FsStr
Borrowed reference to an VEXos filesystem OS string.
FsString
A type that represents a mutable and owned VEXos filesystem string, while being cheaply inter-convertible with Rust strings.
Metadata
Metadata information about a file.
OpenOptions
Options and flags which can be used to configure how a file is opened.
ReadDir
An iterator over the entries of a directory.

Functions§

copy
Copies the contents of one file to another.
exists
Returns true if the path points to a file that exists on the filesystem.
metadata
Gets the metadata for a file or path.
read
Reads the entire contents of a file into a vector.
read_dir
Returns an iterator over the items in a directory.
read_to_string
Reads the entire contents of a file into a string.
write
Writes an entire buffer to a file, replacing its contents.