A virtual filesystem for Rust
The virtual file system abstraction generalizes over file systems and allows using different filesystem implementations (e.g. an in memory implementation for unit tests).
The primary envisioned use case is applications that need assets to be embedded in the executable or bundled as a resource archive:
This crate currently has the following implementations:
embedded-fs feature, no async version availableThe minimum supported Rust version (MSRV) is 1.63.
Comments and pull-requests welcome!
Note for async users: I intend to sunset the async_vfs feature in the future since the async-std crate is discontinued. If you have any comments or
feedback, please leave a comment on issue #77.
EmbeddedFS for doc.rs. (#88) - thanks James2022-rgb and @Infinoid!export-test-macros in lib.rs - thanks @feznyng for the reminder!flush() method now makes the written data available to read calls (fixes #70 - thanks @krisajenkins for the throrough bug report!)Arc<str> for paths internally to reduce string allocations - thanks @BrettMayson!async_vfs.
The module is behind the async-vfs feature flag which is not enabled by default. Huge thank you to @Fredrik Reinholdsen!Path::create_dir_all() failures when executing in parallel
(fixes #47)VfsPath::join()
(#45 - thanks @Property404)VfsPath::is_root()
(#44 - thanks @Property404)Path::join() now allows resolving '..' at the root (resolving to root itself)
(#41 - thanks @Property404)Send to trait objects returned from APIs
(#40,
#46 - thanks @Property404)std::error::Error for VfsError (#32) and improved error
ergonomics for end users (#34) - thanks @TechnohackerMemoryFS::append_file() (closes
#31)EmbeddedFS to rust-embed v6 (closes #29)OverlayFS and AltrootFS available at the crate root, making it more consistent
(PR #30 -
thanks @Zyian)embedded-fs feature when building on docs.rs to ensure that it actually shows up there
(#28 - thanks @Absolucy)VfsPath::root() method to access the root path of a virtual filesystem
(closes #26)VfsPath docs to provide usage examplesEmbeddedFS (closes #24)test_vfs_readonly! which allows verifying read-only filesystem implementationsthiserror crate to improve compile times
(closes #25)OverlayFS (closes #23)VfsPath::join() now takes AsRef instead of &str to improve ergonomics with crates like caminotest_vfs macro via the feature flag export-test-macros to allow downstream implementations to verify
expected behaviourEmbeddedFS for using filesystems embeded in the binary using
rust-embed
(PR #12 - thanks @ahouts)VfsPath::exists() to return VfsResult<bool> instead of plain bool (closes #17)OverlayFS union filesystemVfsPath::read_to_string() convenience methodVfsPath::walk_dir() method for recursive directory traversalVfsPath::{copy,move}_{file,dir}() methods (closes #9)AltrootFS (thanks @icefoxen)(top 24 of 28)
853 followers · starred Sep 2021
364 followers · starred Nov 2024
619 followers · starred Nov 2023
472 followers · starred Jun 2023
A virtual filesystem for Rust
The virtual file system abstraction generalizes over file systems and allows using different filesystem implementations (e.g. an in memory implementation for unit tests).
The primary envisioned use case is applications that need assets to be embedded in the executable or bundled as a resource archive:
This crate currently has the following implementations:
embedded-fs feature, no async version availableThe minimum supported Rust version (MSRV) is 1.63.
Comments and pull-requests welcome!
Note for async users: I intend to sunset the async_vfs feature in the future since the async-std crate is discontinued. If you have any comments or
feedback, please leave a comment on issue #77.
EmbeddedFS for doc.rs. (#88) - thanks James2022-rgb and @Infinoid!export-test-macros in lib.rs - thanks @feznyng for the reminder!flush() method now makes the written data available to read calls (fixes #70 - thanks @krisajenkins for the throrough bug report!)Arc<str> for paths internally to reduce string allocations - thanks @BrettMayson!async_vfs.
The module is behind the async-vfs feature flag which is not enabled by default. Huge thank you to @Fredrik Reinholdsen!Path::create_dir_all() failures when executing in parallel
(fixes #47)VfsPath::join()
(#45 - thanks @Property404)VfsPath::is_root()
(#44 - thanks @Property404)Path::join() now allows resolving '..' at the root (resolving to root itself)
(#41 - thanks @Property404)Send to trait objects returned from APIs
(#40,
#46 - thanks @Property404)std::error::Error for VfsError (#32) and improved error
ergonomics for end users (#34) - thanks @TechnohackerMemoryFS::append_file() (closes
#31)EmbeddedFS to rust-embed v6 (closes #29)OverlayFS and AltrootFS available at the crate root, making it more consistent
(PR #30 -
thanks @Zyian)embedded-fs feature when building on docs.rs to ensure that it actually shows up there
(#28 - thanks @Absolucy)VfsPath::root() method to access the root path of a virtual filesystem
(closes #26)VfsPath docs to provide usage examplesEmbeddedFS (closes #24)test_vfs_readonly! which allows verifying read-only filesystem implementationsthiserror crate to improve compile times
(closes #25)OverlayFS (closes #23)VfsPath::join() now takes AsRef instead of &str to improve ergonomics with crates like caminotest_vfs macro via the feature flag export-test-macros to allow downstream implementations to verify
expected behaviourEmbeddedFS for using filesystems embeded in the binary using
rust-embed
(PR #12 - thanks @ahouts)VfsPath::exists() to return VfsResult<bool> instead of plain bool (closes #17)OverlayFS union filesystemVfsPath::read_to_string() convenience methodVfsPath::walk_dir() method for recursive directory traversalVfsPath::{copy,move}_{file,dir}() methods (closes #9)AltrootFS (thanks @icefoxen)(top 24 of 28)
853 followers · starred Sep 2021
364 followers · starred Nov 2024
619 followers · starred Nov 2023
472 followers · starred Jun 2023