| Crates.io | kxio |
| lib.rs | kxio |
| version | 5.1.0 |
| created_at | 2024-04-08 17:14:22.866566+00 |
| updated_at | 2025-01-18 17:47:12.440735+00 |
| description | Provides injectable Filesystem and Network resources to make code more testable |
| homepage | |
| repository | https://git.kemitix.net/kemitix/kxio |
| max_upload_size | |
| id | 1200669 |
| size | 218,254 |
kxio is a Rust library that provides injectable FileSystem, Network and
Print resources to enhance the testability of your code. By abstracting
system-level interactions, kxio enables easier mocking and testing of code
that relies on file system and network operations.
The Filesystem module offers a clean abstraction over std::fs, the standard
file system operations. For comprehensive documentation and usage examples,
please refer to https://docs.rs/kxio/latest/kxio/fs/.
.reader().bytes()The Network module offers a testable interface over the reqwest crate. For
comprehensive documentation and usage examples, please refer to
https://docs.rs/kxio/latest/kxio/net/
The Print module provides three implementations of the Printer trait:
StandardPrint - behaves as normal, printing to STDOUT and STDERRNullPrint - swallows all prints, outputting nothingTestPrint - captures all print output and makes it available for assertions in testsIt also provides macros to use with each:
kxprintlnkxprintkxeprintlnkxeprintThey are analogous to the std macros: println, print, eprintln and eprint respectively.
Each of the kx{e}print{ln} macros takes a reference to an instance of the Printer trait as the first parameter.
For comprehensive documentation and usage examples, please refer to https://docs.rs/kxio/latest/kxio/print/
Add kxio to your Cargo.toml:
[dependencies]
kxio = "x.y.z"
See the example get.rs for an annotated example on how to use the kxio library.
It covers both the net and fs modules.
Contributions are welcome! Please check our issue tracker for open tasks or submit your own ideas.
This project is licensed under the terms specified in the LICENSE file in the
repository root.
For more information, bug reports, or feature requests, please visit our repository.