Crate kxio

Source
Expand description

§kxio

kxio is a Rust library that provides injectable FileSystem, Network and Printer 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, network and print 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/

§Printer

No, not a hardware printer, but console output via the family of println macros from the Standard Library.

§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 the net, fs and print 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.


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

Modules§

fs
Provides an injectable reference to part of the filesystem.
net
Provides a generic interface for network operations.
print
Provides an injectable interface for standard print operations.

Macros§

kxeprint
kxeprintln
kxprint
kxprintln
Macro to print the expression to the Printer with a trailing newline.

Enums§

Error
Represents a error accessing the file system or network.

Type Aliases§

Result
Represents a success or a failure using fs or net.