1
0
Fork
You've already forked kxio
0
A Rust library that provides injectable FileSyste, Network and Print resources to enhance the testability of your code.
  • Rust 98.4%
  • Just 1.5%
2026年05月21日 06:13:45 +00:00
.cargo build: switch to forgejo actions 2024年10月29日 22:30:17 +00:00
.crow chore: update CI config to latest patterns, remove bacon.toml 2026年05月21日 06:13:45 +00:00
.git-hooks feat: initial empty library 2024年04月08日 14:33:39 +01:00
examples ci: add CrowCI workflow and add ci recipe to justfile 2026年05月19日 19:45:44 +00:00
src ci: add CrowCI workflow and add ci recipe to justfile 2026年05月19日 19:45:44 +00:00
tests tests(net): add explicit tests for assert_no_unused_plans 2024年12月29日 22:07:41 +00:00
.gitignore ci: add CrowCI workflow and add ci recipe to justfile 2026年05月19日 19:45:44 +00:00
.rgignore feat: initial empty library 2024年04月08日 14:33:39 +01:00
Cargo.toml chore(deps): bump derive_more from 1.0 to 2.0 2025年02月27日 15:10:01 +00:00
CHANGELOG.md chore: release v5.1.0 2025年01月18日 17:39:40 +00:00
justfile ci: add CrowCI workflow and add ci recipe to justfile 2026年05月19日 19:45:44 +00:00
LICENSE feat: initial empty library 2024年04月08日 14:33:39 +01:00
README.md docs(print): add details to readme and an example 2024年12月29日 19:57:20 +00:00
renovate.json chore(deps): prevent renovate creating pointless PRs 2024年04月27日 14:29:48 +01:00

kxio

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.

Features

  • Filesystem Abstraction
  • Network Abstraction
  • Print 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/

Print

The Print module provides three implementations of the Printer trait:

  • StandardPrint - behaves as normal, printing to STDOUT and STDERR
  • NullPrint - swallows all prints, outputting nothing
  • TestPrint - captures all print output and makes it available for assertions in tests

It also provides macros to use with each:

  • kxprintln
  • kxprint
  • kxeprintln
  • kxeprint

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

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.