From 638246385a15f244899fb524017eb533fe765cda Mon Sep 17 00:00:00 2001 From: Andrew Gauger Date: Thu, 19 Sep 2019 12:52:27 -0700 Subject: [PATCH] Removing references to rand < .5 --- Cargo.toml | 3 +-- src/web/clients/download/basic.md | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) mode change 100644 => 100755 Cargo.toml mode change 100644 => 100755 src/web/clients/download/basic.md diff --git a/Cargo.toml b/Cargo.toml old mode 100644 new mode 100755 index 5a89507..c4ee038 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,6 @@ ndarray = "0.12" num = "0.2" num_cpus = "1.8" petgraph = "0.4" -postgres = "0.15" rand = "0.6" rayon = "1.0" regex = "1.0" @@ -47,7 +46,7 @@ serde = "1.0" serde_derive = "1.0" serde_json = "1.0" tar = "0.4.12" -tempdir = "0.3.5" +tempfile = "3.1" threadpool = "1.6" toml = "0.4" unicode-segmentation = "1.2.1" diff --git a/src/web/clients/download/basic.md b/src/web/clients/download/basic.md old mode 100644 new mode 100755 index abb63ff..f1fd0b3 --- a/src/web/clients/download/basic.md +++ b/src/web/clients/download/basic.md @@ -2,22 +2,22 @@ [![reqwest-badge]][reqwest] [![tempdir-badge]][tempdir] [![cat-net-badge]][cat-net] [![cat-filesystem-badge]][cat-filesystem] -Creates a temporary directory with [`TempDir::new`] and synchronously downloads +Creates a temporary directory with [`tempfile::Builder`] and synchronously downloads a file over HTTP using [`reqwest::get`]. Creates a target [`File`] with name obtained from [`Response::url`] within -[`TempDir::path`] and copies downloaded data into it with [`io::copy`]. +[`tempdir()`] and copies downloaded data into it with [`io::copy`]. The temporary directory is automatically removed on `run` function return. ```rust,no_run # #[macro_use] # extern crate error_chain; extern crate reqwest; -extern crate tempdir; +extern crate tempfile; use std::io::copy; use std::fs::File; -use tempdir::TempDir; +use tempfile::Builder; # # error_chain! { # foreign_links { @@ -27,7 +27,7 @@ use tempdir::TempDir; # } fn run() -> Result<()> { - let tmp_dir = TempDir::new("example")?; + let tmp_dir = Builder::new().prefix("example").tempdir()?; let target = "https://www.rust-lang.org/logos/rust-logo-512x512.png"; let mut response = reqwest::get(target)?; @@ -55,5 +55,5 @@ fn run() -> Result<()> { [`io::copy`]: https://doc.rust-lang.org/std/io/fn.copy.html [`reqwest::get`]: https://docs.rs/reqwest/*/reqwest/fn.get.html [`Response::url`]: https://docs.rs/reqwest/*/reqwest/struct.Response.html#method.url -[`TempDir::new`]: https://docs.rs/tempdir/*/tempdir/struct.TempDir.html#method.new -[`TempDir::path`]: https://docs.rs/tempdir/*/tempdir/struct.TempDir.html#method.path +[`tempfile::Builder`]: https://docs.rs/tempfile/*/tempfile/struct.Builder.html +[`tempdir()`]: https://docs.rs/tempfile/3.1.0/tempfile/struct.Builder.html#method.tempdir