Crate cap_std

source ·
Expand description

A capability-based API modeled after std.

This corresponds to std.

Capability-based APIs represent access to external resources as values which can be passed around between different parts of a program.

Two notable features are the Dir and Pool types:

  • Dir represents an open directory in a filesystem. Instead of opening files by absolute paths or paths relative to the current working directory, files are opened via paths relative to a Dir. The concepts of a process-wide “current working directory” and a single global filesystem namespace are de-emphasized.
  • Pool represents a set of network addresses. Instead of allowing applications to request access to any address and then applying process-wide filtering rules, filtering rules are built into pools which may be passed through the program.

On WASI, use of this library closely reflects the underlying system API, so it avoids compatibility layers.



  • A capability-based filesystem API modeled after std::fs.
  • fs_utf8fs_utf8
    A fully UTF-8 filesystem API modeled after cap_std::fs.
  • netNon-WASI
    A capability-based network API modeled after std::net.
  • OS-specific functionality.
  • A capability-based clock API modeled after std::time.


  • Instances of this AmbientAuthority type serve to indicate that the ambient_authority function has been called, indicating that the user has explicitly opted into using ambient authority.


  • Return an AmbientAuthority value, which allows use of functions that include an AmbientAuthority argument.