mirror of https://github.com/smol-rs/smol
19 lines
419 B
Rust
19 lines
419 B
Rust
// TODO: document
|
|
//! Prints a file given as an argument to stdout.
|
|
|
|
use std::env;
|
|
use std::fs::File;
|
|
use std::io;
|
|
|
|
fn main() -> io::Result<()> {
|
|
let path = env::args().nth(1).expect("missing path argument");
|
|
|
|
smol::run(async {
|
|
let file = smol::reader(File::open(path)?);
|
|
let mut stdout = smol::writer(io::stdout());
|
|
|
|
futures::io::copy(file, &mut stdout).await?;
|
|
Ok(())
|
|
})
|
|
}
|