https://github.com/pimalaya/io-fs
Set of I/O-free Rust coroutines and runtimes to manage filesystems
https://github.com/pimalaya/io-fs
coroutine directory file filesystem fs io-free library rust sans-io
Last synced: 4 months ago
JSON representation
Set of I/O-free Rust coroutines and runtimes to manage filesystems
- Host: GitHub
- URL: https://github.com/pimalaya/io-fs
- Owner: pimalaya
- License: mit
- Created: 2025-04-26T14:54:56.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-19T14:17:21.000Z (about 1 year ago)
- Last Synced: 2025-05-19T15:33:06.102Z (about 1 year ago)
- Topics: coroutine, directory, file, filesystem, fs, io-free, library, rust, sans-io
- Language: Rust
- Homepage: https://docs.rs/io-fs/latest/io_fs
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# I/O Filesystem [](https://docs.rs/io-fs/latest/io_fs) [](https://matrix.to/#/#pimalaya:matrix.org)
Set of **I/O-free** Rust coroutines and runtimes to manage filesystems.
This library allows you to manage filesystems using an I/O-agnostic approach, based on 3 concepts:
### Coroutine
A coroutine is an *I/O-free*, *resumable* and *composable* state machine that **emits I/O requests**. A coroutine is considered *terminated* when it does not emit I/O requests anymore.
*See available coroutines at [./src/coroutines](https://github.com/pimalaya/io-fs/tree/master/src/coroutines).*
### Runtime
A runtime contains all the I/O logic, and is responsible for **processing I/O requests** emitted by coroutines.
*See available runtimes at [./src/runtimes](https://github.com/pimalaya/io-fs/tree/master/src/runtimes).*
### Loop
The loop is the glue between coroutines and runtimes. It makes the coroutine progress while allowing runtime to process I/O.
## Examples
### Read a directory synchronously
```rust,ignore
use io_fs::{coroutines::ReadDir, runtimes::std::handle};
let mut output = None;
let mut coroutine = ReadDir::new("/tmp");
let entries = loop {
match coroutine.resume(output) {
Ok(entries) => break entries,
Err(io) => output = Some(handle(io).unwrap()),
}
};
println!("Entries inside /tmp:");
for path in paths {
println!(" - {}", path.display());
}
```
*See complete example at [./examples/std-read-dir.rs](https://github.com/pimalaya/io-fs/blob/master/examples/std-read-dir.rs).*
### More examples
Have a look at projects built on the top of this library:
- [io-vdir](https://github.com/pimalaya/io-vdir): Set of I/O-free Rust coroutines and runtimes to manage [Vdir](https://vdirsyncer.pimutils.org/en/stable/vdir.html) filesystems.
## Sponsoring
[](https://nlnet.nl/)
Special thanks to the [NLnet foundation](https://nlnet.nl/) and the [European Commission](https://www.ngi.eu/) that helped the project to receive financial support from various programs:
- [NGI Assure](https://nlnet.nl/project/Himalaya/) in 2022
- [NGI Zero Entrust](https://nlnet.nl/project/Pimalaya/) in 2023
- [NGI Zero Core](https://nlnet.nl/project/Pimalaya-PIM/) in 2024 *(still ongoing)*
If you appreciate the project, feel free to donate using one of the following providers:
[](https://github.com/sponsors/soywod)
[](https://ko-fi.com/soywod)
[](https://www.buymeacoffee.com/soywod)
[](https://liberapay.com/soywod)
[](https://thanks.dev/soywod)
[](https://www.paypal.com/paypalme/soywod)