#testing #mocking #networking #injectable #resources #abstraction

kxio

Provides injectable Filesystem and Network resources to make code more testable

13 releases (stable)

3.1.0 Nov 21, 2024
3.0.0 Nov 20, 2024
2.1.1 Nov 16, 2024
1.2.0 May 17, 2024
0.1.2 Apr 10, 2024

#283 in Filesystem

Download history 31/week @ 2024-08-18 188/week @ 2024-08-25 127/week @ 2024-09-01 112/week @ 2024-09-08 86/week @ 2024-09-15 138/week @ 2024-09-22 192/week @ 2024-09-29 12/week @ 2024-10-06 14/week @ 2024-10-13 56/week @ 2024-10-20 26/week @ 2024-10-27 49/week @ 2024-11-03 381/week @ 2024-11-10 409/week @ 2024-11-17 179/week @ 2024-11-24 87/week @ 2024-12-01

1,066 downloads per month
Used in 4 crates

MIT license

76KB
1K SLoC

kxio

kxio is a Rust library that provides injectable FileSystem and Network 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.

Features

  • Filesystem Abstraction
  • Network Abstraction
  • Enhanced Testability

Filesystem

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/.

Key Filesystem Features:

  • File reading and writing
  • Directory operations
  • File metadata access
  • Fluent API for operations like .reader().bytes()

Network

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/

Getting Started

Add kxio to your Cargo.toml:

[dependencies]
kxio = "x.y.z"

Usage

See the example get.rs for an annotated example on how to use the kxio library. It covers both the net and fs modules.

Development

Contributing

Contributions are welcome! Please check our issue tracker for open tasks or submit your own ideas.

License

This project is licensed under the terms specified in the LICENSE file in the repository root.

Acknowledgements

  • Built with Rust

For more information, bug reports, or feature requests, please visit our repository.

Dependencies

~8–21MB
~301K SLoC