Skip to main content

Module fs

Module fs 

Source
Expand description

Abstract filesystem trait and the default OS-backed implementation.

All I/O in this crate goes through Fs rather than std::fs / tokio::fs directly. This makes it possible to swap in an in-memory implementation for:

  • Unit tests — avoid touching the real disk.
  • WASM / LSP clients — provide file content from the editor’s in-memory document model instead of reading from disk, so the server sees unsaved changes immediately.

The default OsFs implementation (enabled by the tokio feature) delegates to tokio::fs and is suitable for a native language server process.

All paths are represented as url::Url with the file:// scheme. Directory URLs always end with a trailing / so that Url::join appends correctly.

Structs§

FsDirEntry
Entry returned by Fs::read_dir.
OsFs
Standard filesystem implementation using tokio::fs.

Traits§

Fs
Abstract filesystem trait. Implement this to provide a custom backend (e.g., in-memory for WASM, or virtual for testing).

Functions§

exists
Check whether a URL exists (file or directory).
walk_dir
Recursively walk a directory, returning all file URLs.