mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2024-11-21 19:13:07 +00:00
Removing references to rand < .5
This commit is contained in:
parent
cb949b04c0
commit
638246385a
2 changed files with 8 additions and 9 deletions
3
Cargo.toml
Normal file → Executable file
3
Cargo.toml
Normal file → Executable file
|
@ -33,7 +33,6 @@ ndarray = "0.12"
|
||||||
num = "0.2"
|
num = "0.2"
|
||||||
num_cpus = "1.8"
|
num_cpus = "1.8"
|
||||||
petgraph = "0.4"
|
petgraph = "0.4"
|
||||||
postgres = "0.15"
|
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
rayon = "1.0"
|
rayon = "1.0"
|
||||||
regex = "1.0"
|
regex = "1.0"
|
||||||
|
@ -47,7 +46,7 @@ serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
tar = "0.4.12"
|
tar = "0.4.12"
|
||||||
tempdir = "0.3.5"
|
tempfile = "3.1"
|
||||||
threadpool = "1.6"
|
threadpool = "1.6"
|
||||||
toml = "0.4"
|
toml = "0.4"
|
||||||
unicode-segmentation = "1.2.1"
|
unicode-segmentation = "1.2.1"
|
||||||
|
|
14
src/web/clients/download/basic.md
Normal file → Executable file
14
src/web/clients/download/basic.md
Normal file → Executable file
|
@ -2,22 +2,22 @@
|
||||||
|
|
||||||
[![reqwest-badge]][reqwest] [![tempdir-badge]][tempdir] [![cat-net-badge]][cat-net] [![cat-filesystem-badge]][cat-filesystem]
|
[![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`].
|
a file over HTTP using [`reqwest::get`].
|
||||||
|
|
||||||
Creates a target [`File`] with name obtained from [`Response::url`] within
|
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.
|
The temporary directory is automatically removed on `run` function return.
|
||||||
|
|
||||||
```rust,no_run
|
```rust,no_run
|
||||||
# #[macro_use]
|
# #[macro_use]
|
||||||
# extern crate error_chain;
|
# extern crate error_chain;
|
||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
extern crate tempdir;
|
extern crate tempfile;
|
||||||
|
|
||||||
use std::io::copy;
|
use std::io::copy;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use tempdir::TempDir;
|
use tempfile::Builder;
|
||||||
#
|
#
|
||||||
# error_chain! {
|
# error_chain! {
|
||||||
# foreign_links {
|
# foreign_links {
|
||||||
|
@ -27,7 +27,7 @@ use tempdir::TempDir;
|
||||||
# }
|
# }
|
||||||
|
|
||||||
fn run() -> Result<()> {
|
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 target = "https://www.rust-lang.org/logos/rust-logo-512x512.png";
|
||||||
let mut response = reqwest::get(target)?;
|
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
|
[`io::copy`]: https://doc.rust-lang.org/std/io/fn.copy.html
|
||||||
[`reqwest::get`]: https://docs.rs/reqwest/*/reqwest/fn.get.html
|
[`reqwest::get`]: https://docs.rs/reqwest/*/reqwest/fn.get.html
|
||||||
[`Response::url`]: https://docs.rs/reqwest/*/reqwest/struct.Response.html#method.url
|
[`Response::url`]: https://docs.rs/reqwest/*/reqwest/struct.Response.html#method.url
|
||||||
[`TempDir::new`]: https://docs.rs/tempdir/*/tempdir/struct.TempDir.html#method.new
|
[`tempfile::Builder`]: https://docs.rs/tempfile/*/tempfile/struct.Builder.html
|
||||||
[`TempDir::path`]: https://docs.rs/tempdir/*/tempdir/struct.TempDir.html#method.path
|
[`tempdir()`]: https://docs.rs/tempfile/3.1.0/tempfile/struct.Builder.html#method.tempdir
|
||||||
|
|
Loading…
Reference in a new issue