cap_std

Module fs

Source
Expand description

A capability-based filesystem API modeled after std::fs.

This corresponds to std::fs.

Instead of std::fs’s free functions and std::fs::File’s constructors which operate on bare paths, this crate has methods on Dir which operate on paths which must be relative to the directory.

Where std says “the filesystem”, this API says “a filesystem”, as it doesn’t assume that there’s a single global filesystem namespace.

Since all functions which expose raw file descriptors are unsafe, I/O handles in this API are unforgeable (unsafe code notwithstanding). This combined with a lack of absolute paths provides a natural capability-based interface.

This crate uses the existing std::path::Path rather than having its own path type, however while std::path::Path is mostly just a pure datatype, it includes aliases for several std::fs functions. To preserve the capability-based interface, avoid using std::path::Path’s canonicalize, read_link, read_dir, metadata, and symlink_metadata functions.

Structs§

  • A reference to an open directory on a filesystem.
  • A builder used to create directories in various manners.
  • Entries returned by the ReadDir iterator.
  • A reference to an open file on a filesystem.
  • A structure representing a type of file with accessors for each file type.
  • Metadata information about a file.
  • Options and flags which can be used to configure how a file is opened.
  • Representation of the various permissions on a file.
  • Iterator over the entries in a directory.

Traits§

  • FileTypeExtUnix, or target_os="vxworks", or Windows and windows_file_type_ext
    Unix-specific extensions for FileType.