io-providers
Defines "provider" traits and implementations for different types of I/O operations.
- Documentation: https://pshendry.github.io/io-providers/io_providers/
- Crate information: https://crates.io/crates/io-providers
The purpose of this is mainly for dependency injection: by having your code depend on a generic provider, it can be tested by giving it a virtual, inspectable implementation of that provider. In production, the "real" implementation can be used.
Example
Cargo.toml
:
[dependencies]
io-providers = "0.1"
src/main.rs
extern crate io_providers;
use Write;
use Path;
use ;
use Provider as EnvProvider;
use Provider as StreamProvider;
/// Gets the current working directory and prints it to stdout.
License
io-providers
is distributed under the MIT license.