This is an exercise testing out the macros from the ez
crate, and potential
changes for ezio
. Nobody should use this directly. If this has any good ideas,
we'll see about upstreaming them instead.
.write
method was renamed .write_str
to disambiguate it in case both
write traits are imported at once.try_
alternatives added (though in
most) cases we're just throwing an eyre::Report
instead of anything more
specific.ezio offers an easy to use IO API for reading and writing to files and stdio. ezio includes utilities for generating random numbers and other IO-like functionality. Performance and idiomatic error handling are explicit non-goals, so ezio is probably not suitable for production use. It is better suited for education, experimentation, and prototyping.
ezio wraps the standard library's IO APIs and other well-established crates, and is designed to interoperate with them, so ezio should be compatible with most upstream libraries.
```rust use ezio::prelude::*;
fn main() { // Read a line from stdin let _ = stdio::read_line();
// Iterate lines in a file
for line in file::reader("path/to/file.txt") {
// ...
}
// Read a whole file
let _ = file::read("path/to/file.txt");
// Write to a file
file::write("path/to/file.txt", "Some text");
// Write multiple things to a file
let mut w = file::writer("path/to/file.txt");
w.write("Some text\n");
w.write("Some more text");
// Generates a random u32
let _ = random::u32();
} ```
(ezio is work in progress, so these may still be aspirational)
try_
versions of functions where you really
need an error