Skip to content

Instantly share code, notes, and snippets.

@tailhook
Last active May 29, 2016 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tailhook/7349eb6b9c327a27142754855827070c to your computer and use it in GitHub Desktop.
Save tailhook/7349eb6b9c327a27142754855827070c to your computer and use it in GitHub Desktop.
fn render_docs(source: &Path, dest: &Path) -> Result<(), io::Error> {
let dir_list = try!(read_dir(source)
.map_err(|e| Error::Io(source.to_path_buf(), e)));
for entry_res in dir_list {
let entry = try!(entry_res
.map_err(|e| Error::Io(source.to_path_buf(), e)));
let path = entry.path();
let file = try!(File::open(&path)
.map_err(|e| Error::Io(path.clone(), e)));
for line_res in file.lines() {
let line = try!(line_res
.map_err(|e| Error::Io(source.to_path_buf(), e)));
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment