The following cp program demonstrates a simple version of the cp utility in Rust. It copies a file by repeatedly calling read() into a fixed-size buffer and write_all() to the destination.
This zip file contains the complete crate.