mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1563925 - Update crates that have new versions that use rand 0.7. r=firefox-build-system-reviewers,chmanchester
As well as a in-tree crate. Differential Revision: https://phabricator.services.mozilla.com/D55916 --HG-- rename : third_party/rust/tokio-threadpool/src/blocking.rs => third_party/rust/tokio-threadpool/src/blocking/global.rs extra : moz-landing-system : lando
This commit is contained in:
parent
83be0128f4
commit
492fa49342
60
Cargo.lock
generated
60
Cargo.lock
generated
@ -310,9 +310,9 @@ dependencies = [
|
||||
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"guid_win 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -443,7 +443,7 @@ dependencies = [
|
||||
"rust_cascade 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"storage_variant 0.1.0",
|
||||
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thin-vec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xpcom 0.1.0",
|
||||
@ -1226,7 +1226,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rkv 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1634,11 +1634,11 @@ dependencies = [
|
||||
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-reactor 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-tcp 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1774,7 +1774,7 @@ dependencies = [
|
||||
"nsstring 0.1.0",
|
||||
"rkv 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"storage_variant 0.1.0",
|
||||
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thin-vec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xpcom 0.1.0",
|
||||
]
|
||||
@ -2207,7 +2207,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -2248,7 +2248,7 @@ dependencies = [
|
||||
name = "mozprofile"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3833,12 +3833,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.0.5"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3978,12 +3978,12 @@ dependencies = [
|
||||
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-fs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-reactor 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-tcp 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-udp 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -4005,12 +4005,12 @@ version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-executor"
|
||||
version = "0.1.7"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -4024,7 +4024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4058,7 +4058,7 @@ dependencies = [
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -4077,18 +4077,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-threadpool"
|
||||
version = "0.1.14"
|
||||
version = "0.1.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4099,7 +4099,7 @@ dependencies = [
|
||||
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4326,7 +4326,7 @@ dependencies = [
|
||||
"serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"urlencoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -4390,7 +4390,7 @@ dependencies = [
|
||||
"webrender_api 0.60.0",
|
||||
"webrender_build 0.0.1",
|
||||
"wr_malloc_size_of 0.0.1",
|
||||
"ws 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ws 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4564,7 +4564,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ws"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -4573,7 +4573,7 @@ dependencies = [
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -4654,7 +4654,7 @@ dependencies = [
|
||||
"nsstring 0.1.0",
|
||||
"rkv 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xpcom 0.1.0",
|
||||
]
|
||||
|
||||
@ -5008,7 +5008,7 @@ dependencies = [
|
||||
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
|
||||
"checksum target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7975cb2c6f37d77b190bc5004a2bb015971464756fde9514651a525ada2a741a"
|
||||
"checksum target-lexicon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f4c118a7a38378f305a9e111fcb2f7f838c0be324bfb31a77ea04f7f6e684b4"
|
||||
"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2"
|
||||
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
|
||||
"checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209"
|
||||
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
@ -5025,13 +5025,13 @@ dependencies = [
|
||||
"checksum tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6e93c78d23cc61aa245a8acd2c4a79c4d7fa7fb5c3ca90d5737029f043a84895"
|
||||
"checksum tokio-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "881e9645b81c2ce95fcb799ded2c29ffb9f25ef5bef909089a420e5961dd8ccb"
|
||||
"checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443"
|
||||
"checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e"
|
||||
"checksum tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ca6df436c42b0c3330a82d855d2ef017cd793090ad550a6bc2184f4b933532ab"
|
||||
"checksum tokio-fs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b5cbe4ca6e71cb0b62a66e4e6f53a8c06a6eefe46cc5f665ad6f274c9906f135"
|
||||
"checksum tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a5c9635ee806f26d302b8baa1e145689a280d8f5aa8d0552e7344808da54cc21"
|
||||
"checksum tokio-named-pipes 0.2.0 (git+https://github.com/NikVolf/tokio-named-pipes?branch=stable)" = "<none>"
|
||||
"checksum tokio-reactor 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8703a5762ff6913510dc64272c714c4389ffd8c4b3cf602879b8bd14ff06b604"
|
||||
"checksum tokio-tcp 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5b4c329b47f071eb8a746040465fa751bd95e4716e98daef6a9b4e434c17d565"
|
||||
"checksum tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72558af20be886ea124595ea0f806dd5703b8958e4705429dd58b3d8231f72f2"
|
||||
"checksum tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c32ffea4827978e9aa392d2f743d973c1dfa3730a2ed3f22ce1e6984da848c"
|
||||
"checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e"
|
||||
"checksum tokio-udp 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "43eb534af6e8f37d43ab1b612660df14755c42bd003c5f8d2475ee78cc4600c0"
|
||||
"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445"
|
||||
@ -5073,7 +5073,7 @@ dependencies = [
|
||||
"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9"
|
||||
"checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a"
|
||||
"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
|
||||
"checksum ws 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6f5bb86663ff4d1639408410f50bf6050367a8525d644d49a6894cd618a631"
|
||||
"checksum ws 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94"
|
||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
"checksum x11 2.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39697e3123f715483d311b5826e254b6f3cfebdd83cf7ef3358f579c3d68e235"
|
||||
"checksum xfailure 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da90eac47bf1d7871b75004b9b631d107df15f37669383b23f0b5297bc7516b6"
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"98111ca8df698919e755cff678b7d3cdc4f7d493dc1f31fee7918b4619c550fc","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"8b427f5bc501764575e52ba4f9d95673cf8f6d80a86d0d06599852e1a9a20a36","NEWS":"dec3a2928a14aefbe5fe61846e4a87a8f3501258456d702c522e827ad91ee833","README.md":"c11eeed15c0d5661b25ea32115e23a31e3f529596c43f536d12b2e7a030feadc","src/dir.rs":"1a57b6f1b1ae5896ccd2de48143ced32425e9d800c4aa6890c45001370a1decf","src/error.rs":"e556cb6df652f25ab5b68e398197327664468dde29be0642d497572d536ccea9","src/file/imp/mod.rs":"bec50fb99c14cb4a49402bdbb7c5e6b5b8ff785b06b6fcb13267f35df8f3c8c2","src/file/imp/other.rs":"a6794a75a79b58849e951f0957b9f9df69d2971644ddf8ae602b1a639a873fcb","src/file/imp/unix.rs":"d5b40a692c358bdf509297c75191da89d4608b6f45473ad33ee0e1a3a567a548","src/file/imp/windows.rs":"d81e05a4573539b32f79e35e17d79420d18af28d639d3867ee7c300c69e5a1cd","src/file/mod.rs":"26688b26797b154df30081ecd96656cad17492f321565d8b303d53f44ecbb07e","src/lib.rs":"0e342f61f8de6ac6bf8a9d3fbeeb497dc14fdc865fcc502d477d2ee26c789528","src/spooled.rs":"b97702917bf4d7ffca6dc34fbc624ac8fa34c530154c0826efebd93ee1ca442a","src/util.rs":"52226bbc424ce358dcc2fb6cbe5ea47b7f836611af55aefdbda162db4552ace7","tests/namedtempfile.rs":"5185e2f3b104054d7fc6a8c3463f81f24457f38bbadadde30b0f169cece469c3","tests/spooled.rs":"e9e98431b1427760775ce68a790f524adb67e4bd36a134b4cdbb7f43f5d9d043","tests/tempdir.rs":"a8008a0adc7f0ed6f2f9e73ef0489eda7733b718be96a698a22c7fdc7a759e50","tests/tempfile.rs":"d699b2038906649b811aae6179baa687d427508c26530c39ba32178e1bd1a942"},"package":"7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2"}
|
||||
{"files":{"Cargo.toml":"526cfadda74195985a5d860855ef4d8213661e9fcde075a2c128121aa7848003","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"8b427f5bc501764575e52ba4f9d95673cf8f6d80a86d0d06599852e1a9a20a36","NEWS":"e7da9558db65f61008aa9196066a18bcb16b4c7c4369766a67ea7ec9d52b632d","README.md":"2388f555712995933c80721d9de80fc9fe3428dd61609cc01cd26079bd543468","src/dir.rs":"50501bbbe44046d3f74c2fa1d590405cc898d5d52643f18f28964b7a82eafb80","src/error.rs":"cc7d8eace0fff11cb342158d2885d5637bfb14b24ef30755e808554772039c5f","src/file/imp/mod.rs":"bec50fb99c14cb4a49402bdbb7c5e6b5b8ff785b06b6fcb13267f35df8f3c8c2","src/file/imp/other.rs":"99c8f9f3251199fc31e7b88810134712e5725fb6fa14648696ed5cbea980fc5b","src/file/imp/unix.rs":"afc860978e362b1266b40722181fc3a509af72ce942a1b2dcd38ef1776897af3","src/file/imp/windows.rs":"03d81d71c404f0d448e1162825d6fbd57a78b4af8d4dc5287ec2e7c5a873d7cc","src/file/mod.rs":"ae7246a5c1445afa89765097742c11383ae996ea7046e8903f2dcbdb197bce53","src/lib.rs":"fb0c982c8dd2c6d0211c7d4542fa1c724d9ca45a8828ff5aeae866f4aa9d1507","src/spooled.rs":"34f5305923de710c58228d68c143133a11843e7ad5029ee31448ab4ab6172b74","src/util.rs":"25c62fb5d87411fd9508596db69ea489e9026b9ad0ffc9996db1ac8670b3da02","tests/namedtempfile.rs":"07ad89e54c9ce79d6b85d37d367d9687ec6f2cabc6cc44cdefd42731056afd6a","tests/spooled.rs":"29e797d486d867cb6ac46d4cf126eb5868a069a4070c3f50ffa02fbb0b887934","tests/tempdir.rs":"771d555d4eaa410207d212eb3744e016e0b5a22f1f1b7199636a4fac5daaf952","tests/tempfile.rs":"a1dacfd9b1ee3c40fdde5131b33995f3cfd62a212455c8664a98c735b9954ee6"},"package":"7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"}
|
13
third_party/rust/tempfile/Cargo.toml
vendored
13
third_party/rust/tempfile/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -11,21 +11,22 @@
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "tempfile"
|
||||
version = "3.0.5"
|
||||
version = "3.1.0"
|
||||
authors = ["Steven Allen <steven@stebalien.com>", "The Rust Project Developers", "Ashley Mannix <ashleymannix@live.com.au>", "Jason White <jasonaw0@gmail.com>"]
|
||||
exclude = ["/.travis.yml", "/appveyor.yml"]
|
||||
description = "A library for managing temporary files and directories.\n"
|
||||
description = "A library for managing temporary files and directories."
|
||||
homepage = "http://stebalien.com/projects/tempfile-rs"
|
||||
documentation = "https://docs.rs/tempfile"
|
||||
keywords = ["tempfile", "tmpfile", "filesystem"]
|
||||
license = "MIT/Apache-2.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/Stebalien/tempfile"
|
||||
[dependencies.cfg-if]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.rand]
|
||||
version = "0.6"
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.remove_dir_all]
|
||||
version = "0.5"
|
||||
@ -35,4 +36,4 @@ version = "0.1"
|
||||
version = "0.2.27"
|
||||
[target."cfg(windows)".dependencies.winapi]
|
||||
version = "0.3"
|
||||
features = ["fileapi", "winbase", "handleapi"]
|
||||
features = ["fileapi", "handleapi", "winbase"]
|
||||
|
111
third_party/rust/tempfile/NEWS
vendored
111
third_party/rust/tempfile/NEWS
vendored
@ -1,3 +1,112 @@
|
||||
3.1.0
|
||||
=====
|
||||
|
||||
Features:
|
||||
|
||||
* Bump rand dependency to `0.7`.
|
||||
|
||||
Breaking: The minimum rust version is now `1.32.0`.
|
||||
|
||||
3.0.9
|
||||
=====
|
||||
|
||||
Documentation:
|
||||
|
||||
* Add an example for reopening a named temporary file.
|
||||
* Flesh out the security documentation.
|
||||
|
||||
Features:
|
||||
|
||||
* Introduce an `append` option to the builder.
|
||||
* Errors:
|
||||
* No longer implement the soft-deprecated `description`.
|
||||
* Implement `source` instead of `cause`.
|
||||
|
||||
Breaking: The minimum rust version is now 1.30.
|
||||
|
||||
3.0.8
|
||||
=====
|
||||
|
||||
This is a bugfix release.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Export `PathPersistError`.
|
||||
* Fix a bug where flushing a `SpooledTempFile` to disk could fail to write part
|
||||
of the file in some rare, yet-to-reproduced cases.
|
||||
|
||||
3.0.7
|
||||
=====
|
||||
|
||||
Breaking:
|
||||
|
||||
* `Builder::prefix` and `Builder::suffix` now accept a generic `&AsRef<OsStr>`.
|
||||
This could affect type inference.
|
||||
* Temporary files (except unnamed temporary files on Windows and Linux >= 3.11)
|
||||
now use absolute path names. This will break programs that create temporary
|
||||
files relative to their current working directory when they don't have the
|
||||
search permission (x) on some ancestor directory. This is only likely to
|
||||
affect programs with strange chroot-less filesystem sandboxes. If you believe
|
||||
you're affected by this issue, please comment on #40.
|
||||
|
||||
Features:
|
||||
|
||||
* Accept anything implementing `&AsRef<OsStr>` in the builder: &OsStr, &OsString, &Path, etc.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fix LFS support.
|
||||
* Use absolute paths for named temporary files to guard against changes in the
|
||||
current directory.
|
||||
* Use absolute paths when creating unnamed temporary files on platforms that
|
||||
can't create unlinked or auto-deleted temporary files. This fixes a very
|
||||
unlikely race where the current directory could change while the temporary
|
||||
file is being created.
|
||||
|
||||
Misc:
|
||||
|
||||
* Use modern stdlib features to avoid custom unsafe code. This reduces the
|
||||
number of unsafe blocks from 12 to 4.
|
||||
|
||||
3.0.6
|
||||
=====
|
||||
|
||||
* Don't hide temporary files on windows, fixing #66 and #69.
|
||||
|
||||
3.0.5
|
||||
=====
|
||||
|
||||
Features:
|
||||
|
||||
* Added a spooled temporary file implementation. This temporary file variant
|
||||
starts out as an in-memory temporary file but "rolls-over" onto disk when it
|
||||
grows over a specified size (#68).
|
||||
* Errors are now annotated with paths to make debugging easier (#73).
|
||||
|
||||
Misc:
|
||||
|
||||
* The rand version has been bumped to 0.6 (#74).
|
||||
|
||||
Bugs:
|
||||
|
||||
* Tempfile compiles again on Redox (#75).
|
||||
|
||||
3.0.4
|
||||
=====
|
||||
|
||||
* Now compiles on unsupported platforms.
|
||||
|
||||
3.0.3
|
||||
=====
|
||||
|
||||
* update rand to 0.5
|
||||
|
||||
3.0.2
|
||||
=====
|
||||
|
||||
* Actually *delete* temporary files on non-Linux unix systems (thanks to
|
||||
@oliverhenshaw for the fix and a test case).
|
||||
|
||||
3.0.1
|
||||
=====
|
||||
|
||||
@ -52,7 +161,7 @@ Add LFS Support.
|
||||
|
||||
* Implement `AsRef<File>` for `NamedTempFile` allowing named temporary files to
|
||||
be borrowed as `File`s.
|
||||
* Add a method to convert a `NamedTempFile` to an unnamed temporary `File`.
|
||||
* Add a method to convert a `NamedTempFile` to an unnamed temporary `File`.
|
||||
|
||||
2.0.1
|
||||
=====
|
||||
|
8
third_party/rust/tempfile/README.md
vendored
8
third_party/rust/tempfile/README.md
vendored
@ -15,7 +15,7 @@ patterns and surprisingly difficult to implement securely).
|
||||
Usage
|
||||
-----
|
||||
|
||||
Minimum required Rust version: 1.18.0
|
||||
Minimum required Rust version: 1.32.0
|
||||
|
||||
Add this to your `Cargo.toml`:
|
||||
```toml
|
||||
@ -23,16 +23,10 @@ Add this to your `Cargo.toml`:
|
||||
tempfile = "3"
|
||||
```
|
||||
|
||||
...and this to your crate root:
|
||||
```rust
|
||||
extern crate tempfile;
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
```rust
|
||||
extern crate tempfile;
|
||||
use std::fs::File;
|
||||
use std::io::{Write, Read, Seek, SeekFrom};
|
||||
|
||||
|
10
third_party/rust/tempfile/src/dir.rs
vendored
10
third_party/rust/tempfile/src/dir.rs
vendored
@ -12,8 +12,8 @@ use remove_dir_all::remove_dir_all;
|
||||
use std::path::{self, Path, PathBuf};
|
||||
use std::{fmt, fs, io};
|
||||
|
||||
use error::IoResultExt;
|
||||
use Builder;
|
||||
use crate::error::IoResultExt;
|
||||
use crate::Builder;
|
||||
|
||||
/// Create a new temporary directory.
|
||||
///
|
||||
@ -33,7 +33,6 @@ use Builder;
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::tempdir;
|
||||
/// use std::fs::File;
|
||||
/// use std::io::{self, Write};
|
||||
@ -83,7 +82,6 @@ pub fn tempdir() -> io::Result<TempDir> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::tempdir;
|
||||
/// use std::fs::File;
|
||||
/// use std::io::{self, Write};
|
||||
@ -237,7 +235,7 @@ impl TempDir {
|
||||
}
|
||||
|
||||
/// Attempts to make a temporary directory inside of `dir`.
|
||||
/// The directory and everything inside it will be automatically
|
||||
/// The directory and everything inside it will be automatically
|
||||
/// deleted once the returned `TempDir` is destroyed.
|
||||
///
|
||||
/// # Errors
|
||||
@ -385,7 +383,7 @@ impl AsRef<Path> for TempDir {
|
||||
}
|
||||
|
||||
impl fmt::Debug for TempDir {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("TempDir")
|
||||
.field("path", &self.path())
|
||||
.finish()
|
||||
|
23
third_party/rust/tempfile/src/error.rs
vendored
23
third_party/rust/tempfile/src/error.rs
vendored
@ -1,5 +1,5 @@
|
||||
use std::{error, io, fmt};
|
||||
use std::path::PathBuf;
|
||||
use std::{error, fmt, io};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct PathError {
|
||||
@ -8,18 +8,14 @@ struct PathError {
|
||||
}
|
||||
|
||||
impl fmt::Display for PathError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{} at path {:?}", self.err, self.path)
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for PathError {
|
||||
fn description(&self) -> &str {
|
||||
self.err.description()
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
self.err.cause()
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
self.err.source()
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,10 +33,13 @@ impl<T> IoResultExt<T> for Result<T, io::Error> {
|
||||
P: Into<PathBuf>,
|
||||
{
|
||||
self.map_err(|e| {
|
||||
io::Error::new(e.kind(), PathError {
|
||||
path: path().into(),
|
||||
err: e,
|
||||
})
|
||||
io::Error::new(
|
||||
e.kind(),
|
||||
PathError {
|
||||
path: path().into(),
|
||||
err: e,
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
15
third_party/rust/tempfile/src/file/imp/other.rs
vendored
15
third_party/rust/tempfile/src/file/imp/other.rs
vendored
@ -1,12 +1,15 @@
|
||||
use std::path::Path;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
||||
fn not_supported<T>() -> io::Result<T> {
|
||||
Err(io::Error::new(io::ErrorKind::Other, "operation not supported on this platform"))
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"operation not supported on this platform",
|
||||
))
|
||||
}
|
||||
|
||||
pub fn create_named(_path: &Path) -> io::Result<File> {
|
||||
pub fn create_named(_path: &Path, open_options: &mut OpenOptions) -> io::Result<File> {
|
||||
not_supported()
|
||||
}
|
||||
|
||||
@ -21,3 +24,7 @@ pub fn reopen(_file: &File, _path: &Path) -> io::Result<File> {
|
||||
pub fn persist(_old_path: &Path, _new_path: &Path, _overwrite: bool) -> io::Result<()> {
|
||||
not_supported()
|
||||
}
|
||||
|
||||
pub fn keep(path: &Path) -> io::Result<()> {
|
||||
not_supported()
|
||||
}
|
||||
|
122
third_party/rust/tempfile/src/file/imp/unix.rs
vendored
122
third_party/rust/tempfile/src/file/imp/unix.rs
vendored
@ -1,21 +1,14 @@
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
use libc::{c_char, c_int, link, rename, unlink, O_CLOEXEC, O_CREAT, O_EXCL, O_RDWR};
|
||||
use std::ffi::CString;
|
||||
use std::env;
|
||||
use std::ffi::{CString, OsStr};
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use std::os::unix::fs::{MetadataExt, OpenOptionsExt};
|
||||
use std::path::Path;
|
||||
use util;
|
||||
use crate::util;
|
||||
|
||||
#[cfg(all(lfs_support, target_os = "linux"))]
|
||||
use libc::{fstat64 as fstat, open64 as open, stat64 as stat_t};
|
||||
|
||||
#[cfg(not(any(all(lfs_support, target_os = "linux"), target_os = "redox")))]
|
||||
use libc::{fstat, open, stat as stat_t};
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
use syscall::{self, fstat, open, Stat as stat_t, O_CLOEXEC, O_CREAT, O_EXCL, O_RDWR};
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
use libc::{c_char, c_int, link, rename, unlink};
|
||||
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
#[inline(always)]
|
||||
@ -39,32 +32,26 @@ pub fn cstr(path: &Path) -> io::Result<CString> {
|
||||
.map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "path contained a null"))
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
pub fn create_named(path: &Path) -> io::Result<File> {
|
||||
unsafe {
|
||||
let path = cstr(path)?;
|
||||
let fd = cvt_err(open(
|
||||
path.as_ptr() as *const c_char,
|
||||
O_CLOEXEC | O_EXCL | O_RDWR | O_CREAT,
|
||||
0o600,
|
||||
))?;
|
||||
Ok(FromRawFd::from_raw_fd(fd))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
pub fn create_named(path: &Path) -> io::Result<File> {
|
||||
unsafe {
|
||||
let fd = cvt_err(open(
|
||||
path.as_os_str().as_bytes(),
|
||||
O_CLOEXEC | O_EXCL | O_RDWR | O_CREAT | 0o600,
|
||||
))?;
|
||||
Ok(FromRawFd::from_raw_fd(fd))
|
||||
}
|
||||
pub fn create_named(path: &Path, open_options: &mut OpenOptions) -> io::Result<File> {
|
||||
open_options
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.mode(0o600)
|
||||
.open(path)
|
||||
}
|
||||
|
||||
fn create_unlinked(path: &Path) -> io::Result<File> {
|
||||
let f = create_named(path)?;
|
||||
let tmp;
|
||||
// shadow this to decrease the lifetime. It can't live longer than `tmp`.
|
||||
let mut path = path;
|
||||
if !path.is_absolute() {
|
||||
let cur_dir = env::current_dir()?;
|
||||
tmp = cur_dir.join(path);
|
||||
path = &tmp;
|
||||
}
|
||||
|
||||
let f = create_named(path, &mut OpenOptions::new())?;
|
||||
// don't care whether the path has already been unlinked,
|
||||
// but perhaps there are some IO error conditions we should send up?
|
||||
let _ = fs::remove_file(path);
|
||||
@ -73,18 +60,19 @@ fn create_unlinked(path: &Path) -> io::Result<File> {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn create(dir: &Path) -> io::Result<File> {
|
||||
use libc::O_TMPFILE;
|
||||
match unsafe {
|
||||
let path = cstr(dir)?;
|
||||
open(
|
||||
path.as_ptr() as *const c_char,
|
||||
O_CLOEXEC | O_EXCL | O_TMPFILE | O_RDWR,
|
||||
0o600,
|
||||
)
|
||||
} {
|
||||
-1 => create_unix(dir),
|
||||
fd => Ok(unsafe { FromRawFd::from_raw_fd(fd) }),
|
||||
}
|
||||
use libc::{EISDIR, ENOENT, EOPNOTSUPP, O_EXCL, O_TMPFILE};
|
||||
OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.custom_flags(O_TMPFILE | O_EXCL) // do not mix with `create_new(true)`
|
||||
.open(dir)
|
||||
.or_else(|e| {
|
||||
match e.raw_os_error() {
|
||||
// These are the three "not supported" error codes for O_TMPFILE.
|
||||
Some(EOPNOTSUPP) | Some(EISDIR) | Some(ENOENT) => create_unix(dir),
|
||||
_ => Err(e),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
@ -93,30 +81,26 @@ pub fn create(dir: &Path) -> io::Result<File> {
|
||||
}
|
||||
|
||||
fn create_unix(dir: &Path) -> io::Result<File> {
|
||||
util::create_helper(dir, ".tmp", "", ::NUM_RAND_CHARS, |path| {
|
||||
create_unlinked(&path)
|
||||
})
|
||||
}
|
||||
|
||||
unsafe fn stat(fd: RawFd) -> io::Result<stat_t> {
|
||||
let mut meta: stat_t = ::std::mem::zeroed();
|
||||
cvt_err(fstat(fd, &mut meta))?;
|
||||
Ok(meta)
|
||||
util::create_helper(
|
||||
dir,
|
||||
OsStr::new(".tmp"),
|
||||
OsStr::new(""),
|
||||
crate::NUM_RAND_CHARS,
|
||||
|path| create_unlinked(&path),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn reopen(file: &File, path: &Path) -> io::Result<File> {
|
||||
let new_file = OpenOptions::new().read(true).write(true).open(path)?;
|
||||
unsafe {
|
||||
let old_meta = stat(file.as_raw_fd())?;
|
||||
let new_meta = stat(new_file.as_raw_fd())?;
|
||||
if old_meta.st_dev != new_meta.st_dev || old_meta.st_ino != new_meta.st_ino {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
"original tempfile has been replaced",
|
||||
));
|
||||
}
|
||||
Ok(new_file)
|
||||
let old_meta = file.metadata()?;
|
||||
let new_meta = new_file.metadata()?;
|
||||
if old_meta.dev() != new_meta.dev() || old_meta.ino() != new_meta.ino() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
"original tempfile has been replaced",
|
||||
));
|
||||
}
|
||||
Ok(new_file)
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "redox"))]
|
||||
@ -147,3 +131,7 @@ pub fn persist(old_path: &Path, new_path: &Path, overwrite: bool) -> io::Result<
|
||||
// XXX implement when possible
|
||||
Err(io::Error::from_raw_os_error(syscall::ENOSYS))
|
||||
}
|
||||
|
||||
pub fn keep(_: &Path) -> io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
111
third_party/rust/tempfile/src/file/imp/windows.rs
vendored
111
third_party/rust/tempfile/src/file/imp/windows.rs
vendored
@ -1,85 +1,61 @@
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
use std::os::windows::fs::OpenOptionsExt;
|
||||
use std::os::windows::io::{AsRawHandle, FromRawHandle, RawHandle};
|
||||
use std::path::Path;
|
||||
use std::ptr;
|
||||
use std::{io, iter};
|
||||
|
||||
use winapi::shared::minwindef::DWORD;
|
||||
use winapi::um::fileapi::{CreateFileW, SetFileAttributesW, CREATE_NEW};
|
||||
use winapi::um::fileapi::SetFileAttributesW;
|
||||
use winapi::um::handleapi::INVALID_HANDLE_VALUE;
|
||||
use winapi::um::winbase::{FILE_FLAG_DELETE_ON_CLOSE, MOVEFILE_REPLACE_EXISTING};
|
||||
use winapi::um::winbase::{MoveFileExW, ReOpenFile};
|
||||
use winapi::um::winnt::{FILE_ATTRIBUTE_HIDDEN, FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_TEMPORARY};
|
||||
use winapi::um::winbase::{FILE_FLAG_DELETE_ON_CLOSE, MOVEFILE_REPLACE_EXISTING};
|
||||
use winapi::um::winnt::{FILE_ATTRIBUTE_NORMAL, FILE_ATTRIBUTE_TEMPORARY};
|
||||
use winapi::um::winnt::{FILE_GENERIC_READ, FILE_GENERIC_WRITE, HANDLE};
|
||||
use winapi::um::winnt::{FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE};
|
||||
|
||||
use util;
|
||||
|
||||
#[cfg_attr(irustfmt, rustfmt_skip)]
|
||||
const ACCESS: DWORD = FILE_GENERIC_READ
|
||||
| FILE_GENERIC_WRITE;
|
||||
#[cfg_attr(irustfmt, rustfmt_skip)]
|
||||
const SHARE_MODE: DWORD = FILE_SHARE_DELETE
|
||||
| FILE_SHARE_READ
|
||||
| FILE_SHARE_WRITE;
|
||||
#[cfg_attr(irustfmt, rustfmt_skip)]
|
||||
const FLAGS: DWORD = FILE_ATTRIBUTE_HIDDEN
|
||||
| FILE_ATTRIBUTE_TEMPORARY;
|
||||
use crate::util;
|
||||
|
||||
fn to_utf16(s: &Path) -> Vec<u16> {
|
||||
s.as_os_str()
|
||||
.encode_wide()
|
||||
.chain(Some(0).into_iter())
|
||||
.collect()
|
||||
s.as_os_str().encode_wide().chain(iter::once(0)).collect()
|
||||
}
|
||||
|
||||
fn win_create(
|
||||
path: &Path,
|
||||
access: DWORD,
|
||||
share_mode: DWORD,
|
||||
disp: DWORD,
|
||||
flags: DWORD,
|
||||
) -> io::Result<File> {
|
||||
let path = to_utf16(path);
|
||||
let handle = unsafe {
|
||||
CreateFileW(
|
||||
path.as_ptr(),
|
||||
access,
|
||||
share_mode,
|
||||
0 as *mut _,
|
||||
disp,
|
||||
flags,
|
||||
ptr::null_mut(),
|
||||
)
|
||||
};
|
||||
if handle == INVALID_HANDLE_VALUE {
|
||||
Err(io::Error::last_os_error())
|
||||
} else {
|
||||
Ok(unsafe { File::from_raw_handle(handle as RawHandle) })
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_named(path: &Path) -> io::Result<File> {
|
||||
win_create(path, ACCESS, SHARE_MODE, CREATE_NEW, FLAGS)
|
||||
pub fn create_named(path: &Path, open_options: &mut OpenOptions) -> io::Result<File> {
|
||||
open_options
|
||||
.create_new(true)
|
||||
.read(true)
|
||||
.write(true)
|
||||
.custom_flags(FILE_ATTRIBUTE_TEMPORARY)
|
||||
.open(path)
|
||||
}
|
||||
|
||||
pub fn create(dir: &Path) -> io::Result<File> {
|
||||
util::create_helper(dir, ".tmp", "", ::NUM_RAND_CHARS, |path| {
|
||||
win_create(
|
||||
&path,
|
||||
ACCESS,
|
||||
0, // Exclusive
|
||||
CREATE_NEW,
|
||||
FLAGS | FILE_FLAG_DELETE_ON_CLOSE,
|
||||
)
|
||||
})
|
||||
util::create_helper(
|
||||
dir,
|
||||
OsStr::new(".tmp"),
|
||||
OsStr::new(""),
|
||||
crate::NUM_RAND_CHARS,
|
||||
|path| {
|
||||
OpenOptions::new()
|
||||
.create_new(true)
|
||||
.read(true)
|
||||
.write(true)
|
||||
.share_mode(0)
|
||||
.custom_flags(FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE)
|
||||
.open(path)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
pub fn reopen(file: &File, _path: &Path) -> io::Result<File> {
|
||||
let handle = file.as_raw_handle();
|
||||
unsafe {
|
||||
let handle = ReOpenFile(handle as HANDLE, ACCESS, SHARE_MODE, 0);
|
||||
let handle = ReOpenFile(
|
||||
handle as HANDLE,
|
||||
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
|
||||
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
0,
|
||||
);
|
||||
if handle == INVALID_HANDLE_VALUE {
|
||||
Err(io::Error::last_os_error())
|
||||
} else {
|
||||
@ -88,6 +64,17 @@ pub fn reopen(file: &File, _path: &Path) -> io::Result<File> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn keep(path: &Path) -> io::Result<()> {
|
||||
unsafe {
|
||||
let path_w = to_utf16(path);
|
||||
if SetFileAttributesW(path_w.as_ptr(), FILE_ATTRIBUTE_NORMAL) == 0 {
|
||||
Err(io::Error::last_os_error())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn persist(old_path: &Path, new_path: &Path, overwrite: bool) -> io::Result<()> {
|
||||
// TODO: We should probably do this in one-shot using SetFileInformationByHandle but the API is
|
||||
// really painful.
|
||||
@ -112,7 +99,7 @@ pub fn persist(old_path: &Path, new_path: &Path, overwrite: bool) -> io::Result<
|
||||
let e = io::Error::last_os_error();
|
||||
// If this fails, the temporary file is now un-hidden and no longer marked temporary
|
||||
// (slightly less efficient) but it will still work.
|
||||
let _ = SetFileAttributesW(old_path_w.as_ptr(), FLAGS);
|
||||
let _ = SetFileAttributesW(old_path_w.as_ptr(), FILE_ATTRIBUTE_TEMPORARY);
|
||||
Err(e)
|
||||
} else {
|
||||
Ok(())
|
||||
|
239
third_party/rust/tempfile/src/file/mod.rs
vendored
239
third_party/rust/tempfile/src/file/mod.rs
vendored
@ -3,14 +3,14 @@ use std::env;
|
||||
use std::error;
|
||||
use std::ffi::OsStr;
|
||||
use std::fmt;
|
||||
use std::fs::{self, File};
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::{self, Read, Seek, SeekFrom, Write};
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use error::IoResultExt;
|
||||
use Builder;
|
||||
use crate::error::IoResultExt;
|
||||
use crate::Builder;
|
||||
|
||||
mod imp;
|
||||
|
||||
@ -34,7 +34,6 @@ mod imp;
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::tempfile;
|
||||
/// use std::io::{self, Write};
|
||||
///
|
||||
@ -76,7 +75,6 @@ pub fn tempfile() -> io::Result<File> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::tempfile_in;
|
||||
/// use std::io::{self, Write};
|
||||
///
|
||||
@ -123,17 +121,13 @@ impl From<PathPersistError> for TempPath {
|
||||
}
|
||||
|
||||
impl fmt::Display for PathPersistError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "failed to persist temporary file path: {}", self.error)
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for PathPersistError {
|
||||
fn description(&self) -> &str {
|
||||
"failed to persist temporary file path"
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
Some(&self.error)
|
||||
}
|
||||
}
|
||||
@ -160,7 +154,6 @@ impl TempPath {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
@ -212,7 +205,6 @@ impl TempPath {
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
@ -272,7 +264,6 @@ impl TempPath {
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
@ -310,10 +301,59 @@ impl TempPath {
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
/// Keep the temporary file from being deleted. This function will turn the
|
||||
/// temporary file into a non-temporary file without moving it.
|
||||
///
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// On some platforms (e.g., Windows), we need to mark the file as
|
||||
/// non-temporary. This operation could fail.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
/// # ::std::process::exit(1);
|
||||
/// # }
|
||||
/// # }
|
||||
/// # fn run() -> Result<(), io::Error> {
|
||||
/// let mut file = NamedTempFile::new()?;
|
||||
/// writeln!(file, "Brian was here. Briefly.")?;
|
||||
///
|
||||
/// let path = file.into_temp_path();
|
||||
/// let path = path.keep()?;
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// [`PathPersistError`]: struct.PathPersistError.html
|
||||
pub fn keep(mut self) -> Result<PathBuf, PathPersistError> {
|
||||
match imp::keep(&self.path) {
|
||||
Ok(_) => {
|
||||
// Don't drop `self`. We don't want to try deleting the old
|
||||
// temporary file path. (It'll fail, but the failure is never
|
||||
// seen.)
|
||||
let mut path = PathBuf::new();
|
||||
mem::swap(&mut self.path, &mut path);
|
||||
mem::forget(self);
|
||||
Ok(path)
|
||||
}
|
||||
Err(e) => Err(PathPersistError {
|
||||
error: e,
|
||||
path: self,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for TempPath {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.path.fmt(f)
|
||||
}
|
||||
}
|
||||
@ -353,7 +393,63 @@ impl AsRef<OsStr> for TempPath {
|
||||
///
|
||||
/// # Security
|
||||
///
|
||||
/// This variant is *NOT* secure/reliable in the presence of a pathological temporary file cleaner.
|
||||
/// Most operating systems employ temporary file cleaners to delete old
|
||||
/// temporary files. Unfortunately these temporary file cleaners don't always
|
||||
/// reliably _detect_ whether the temporary file is still being used.
|
||||
///
|
||||
/// Specifically, the following sequence of events can happen:
|
||||
///
|
||||
/// 1. A user creates a temporary file with `NamedTempFile::new()`.
|
||||
/// 2. Time passes.
|
||||
/// 3. The temporary file cleaner deletes (unlinks) the temporary file from the
|
||||
/// filesystem.
|
||||
/// 4. Some other program creates a new file to replace this deleted temporary
|
||||
/// file.
|
||||
/// 5. The user tries to re-open the temporary file (in the same program or in a
|
||||
/// different program) by path. Unfortunately, they'll end up opening the
|
||||
/// file created by the other program, not the original file.
|
||||
///
|
||||
/// ## Operating System Specific Concerns
|
||||
///
|
||||
/// The behavior of temporary files and temporary file cleaners differ by
|
||||
/// operating system.
|
||||
///
|
||||
/// ### Windows
|
||||
///
|
||||
/// On Windows, open files _can't_ be deleted. This removes most of the concerns
|
||||
/// around temporary file cleaners.
|
||||
///
|
||||
/// Furthermore, temporary files are, by default, created in per-user temporary
|
||||
/// file directories so only an application running as the same user would be
|
||||
/// able to interfere (which they could do anyways). However, an application
|
||||
/// running as the same user can still _accidentally_ re-create deleted
|
||||
/// temporary files if the number of random bytes in the temporary file name is
|
||||
/// too small.
|
||||
///
|
||||
/// So, the only real concern on Windows is:
|
||||
///
|
||||
/// 1. Opening a named temporary file in a world-writable directory.
|
||||
/// 2. Using the `into_temp_path()` and/or `into_parts()` APIs to close the file
|
||||
/// handle without deleting the underlying file.
|
||||
/// 3. Continuing to use the file by path.
|
||||
///
|
||||
/// ### UNIX
|
||||
///
|
||||
/// Unlike on Windows, UNIX (and UNIX like) systems allow open files to be
|
||||
/// "unlinked" (deleted).
|
||||
///
|
||||
/// #### MacOS
|
||||
///
|
||||
/// Like on Windows, temporary files are created in per-user temporary file
|
||||
/// directories by default so calling `NamedTempFile::new()` should be
|
||||
/// relatively safe.
|
||||
///
|
||||
/// #### Linux
|
||||
///
|
||||
/// Unfortunately, most _Linux_ distributions don't create per-user temporary
|
||||
/// file directories. Worse, systemd's tmpfiles daemon (a common temporary file
|
||||
/// cleaner) will happily remove open temporary files if they haven't been
|
||||
/// modified within the last 10 days.
|
||||
///
|
||||
/// # Resource Leaking
|
||||
///
|
||||
@ -375,7 +471,7 @@ pub struct NamedTempFile {
|
||||
}
|
||||
|
||||
impl fmt::Debug for NamedTempFile {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "NamedTempFile({:?})", self.path)
|
||||
}
|
||||
}
|
||||
@ -411,16 +507,13 @@ impl From<PersistError> for NamedTempFile {
|
||||
}
|
||||
|
||||
impl fmt::Display for PersistError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "failed to persist temporary file: {}", self.error)
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for PersistError {
|
||||
fn description(&self) -> &str {
|
||||
"failed to persist temporary file"
|
||||
}
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
Some(&self.error)
|
||||
}
|
||||
}
|
||||
@ -433,9 +526,9 @@ impl NamedTempFile {
|
||||
/// # Security
|
||||
///
|
||||
/// This will create a temporary file in the default temporary file
|
||||
/// directory (platform dependent). These directories are often patrolled by temporary file
|
||||
/// cleaners so only use this method if you're *positive* that the temporary file cleaner won't
|
||||
/// delete your file.
|
||||
/// directory (platform dependent). This has security implications on many
|
||||
/// platforms so please read the security section of this type's
|
||||
/// documentation.
|
||||
///
|
||||
/// Reasons to use this method:
|
||||
///
|
||||
@ -467,7 +560,6 @@ impl NamedTempFile {
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
@ -501,15 +593,14 @@ impl NamedTempFile {
|
||||
///
|
||||
/// # Security
|
||||
///
|
||||
/// Only use this method if you're positive that a
|
||||
/// temporary file cleaner won't have deleted your file. Otherwise, the path
|
||||
/// returned by this method may refer to an attacker controlled file.
|
||||
/// Referring to a temporary file's path may not be secure in all cases.
|
||||
/// Please read the security section on the top level documentation of this
|
||||
/// type for details.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
@ -540,7 +631,6 @@ impl NamedTempFile {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
@ -576,9 +666,9 @@ impl NamedTempFile {
|
||||
///
|
||||
/// # Security
|
||||
///
|
||||
/// Only use this method if you're positive that a
|
||||
/// temporary file cleaner won't have deleted your file. Otherwise, you
|
||||
/// might end up persisting an attacker controlled file.
|
||||
/// This method persists the temporary file using it's path and may not be
|
||||
/// secure in the in all cases. Please read the security section on the top
|
||||
/// level documentation of this type for details.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
@ -588,7 +678,6 @@ impl NamedTempFile {
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
@ -631,9 +720,9 @@ impl NamedTempFile {
|
||||
///
|
||||
/// # Security
|
||||
///
|
||||
/// Only use this method if you're positive that a
|
||||
/// temporary file cleaner won't have deleted your file. Otherwise, you
|
||||
/// might end up persisting an attacker controlled file.
|
||||
/// This method persists the temporary file using it's path and may not be
|
||||
/// secure in the in all cases. Please read the security section on the top
|
||||
/// level documentation of this type for details.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
@ -644,7 +733,6 @@ impl NamedTempFile {
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
@ -674,7 +762,48 @@ impl NamedTempFile {
|
||||
}
|
||||
}
|
||||
|
||||
/// Reopen the temporary file.
|
||||
/// Keep the temporary file from being deleted. This function will turn the
|
||||
/// temporary file into a non-temporary file without moving it.
|
||||
///
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// On some platforms (e.g., Windows), we need to mark the file as
|
||||
/// non-temporary. This operation could fail.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io::{self, Write};
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
/// # ::std::process::exit(1);
|
||||
/// # }
|
||||
/// # }
|
||||
/// # fn run() -> Result<(), io::Error> {
|
||||
/// let mut file = NamedTempFile::new()?;
|
||||
/// writeln!(file, "Brian was here. Briefly.")?;
|
||||
///
|
||||
/// let (file, path) = file.keep()?;
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// [`PathPersistError`]: struct.PathPersistError.html
|
||||
pub fn keep(self) -> Result<(File, PathBuf), PersistError> {
|
||||
let (file, path) = (self.file, self.path);
|
||||
match path.keep() {
|
||||
Ok(path) => Ok((file, path)),
|
||||
Err(PathPersistError { error, path }) => Err(PersistError {
|
||||
file: NamedTempFile { path, file },
|
||||
error,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
/// Securely reopen the temporary file.
|
||||
///
|
||||
/// This function is useful when you need multiple independent handles to
|
||||
/// the same file. It's perfectly fine to drop the original `NamedTempFile`
|
||||
@ -685,11 +814,16 @@ impl NamedTempFile {
|
||||
///
|
||||
/// If the file cannot be reopened, `Err` is returned.
|
||||
///
|
||||
/// # Security
|
||||
///
|
||||
/// Unlike `File::open(my_temp_file.path())`, `NamedTempFile::reopen()`
|
||||
/// guarantees that the re-opened file is the _same_ file, even in the
|
||||
/// presence of pathological temporary file cleaners.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use std::io;
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::NamedTempFile;
|
||||
///
|
||||
/// # fn main() {
|
||||
@ -705,7 +839,8 @@ impl NamedTempFile {
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn reopen(&self) -> io::Result<File> {
|
||||
imp::reopen(self.as_file(), NamedTempFile::path(self)).with_err_path(|| NamedTempFile::path(self))
|
||||
imp::reopen(self.as_file(), NamedTempFile::path(self))
|
||||
.with_err_path(|| NamedTempFile::path(self))
|
||||
}
|
||||
|
||||
/// Get a reference to the underlying file.
|
||||
@ -732,6 +867,14 @@ impl NamedTempFile {
|
||||
pub fn into_temp_path(self) -> TempPath {
|
||||
self.path
|
||||
}
|
||||
|
||||
/// Converts the named temporary file into its constituent parts.
|
||||
///
|
||||
/// Note: When the path is dropped, the file is deleted but the file handle
|
||||
/// is still usable.
|
||||
pub fn into_parts(self) -> (File, TempPath) {
|
||||
(self.file, self.path)
|
||||
}
|
||||
}
|
||||
|
||||
impl Read for NamedTempFile {
|
||||
@ -794,8 +937,16 @@ impl std::os::windows::io::AsRawHandle for NamedTempFile {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn create_named(path: PathBuf) -> io::Result<NamedTempFile> {
|
||||
imp::create_named(&path)
|
||||
pub(crate) fn create_named(
|
||||
mut path: PathBuf,
|
||||
open_options: &mut OpenOptions,
|
||||
) -> io::Result<NamedTempFile> {
|
||||
// Make the path absolute. Otherwise, changing directories could cause us to
|
||||
// delete the wrong file.
|
||||
if !path.is_absolute() {
|
||||
path = env::current_dir()?.join(path)
|
||||
}
|
||||
imp::create_named(&path, open_options)
|
||||
.with_err_path(|| path.clone())
|
||||
.map(|file| NamedTempFile {
|
||||
path: TempPath { path },
|
||||
|
123
third_party/rust/tempfile/src/lib.rs
vendored
123
third_party/rust/tempfile/src/lib.rs
vendored
@ -24,14 +24,14 @@
|
||||
//! a temporary file cleaner could delete the temporary file which an attacker could then replace.
|
||||
//!
|
||||
//! `tempfile` doesn't rely on file paths so this isn't an issue. However, `NamedTempFile` does
|
||||
//! rely on file paths.
|
||||
//! rely on file paths for _some_ operations. See the security documentation on
|
||||
//! the `NamedTempFile` type for more information.
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! Create a temporary file and write some data into it:
|
||||
//!
|
||||
//! ```
|
||||
//! # extern crate tempfile;
|
||||
//! use tempfile::tempfile;
|
||||
//! use std::io::{self, Write};
|
||||
//!
|
||||
@ -49,10 +49,40 @@
|
||||
//! # }
|
||||
//! ```
|
||||
//!
|
||||
//! Create a named temporary file and open an independent file handle:
|
||||
//!
|
||||
//! ```
|
||||
//! use tempfile::NamedTempFile;
|
||||
//! use std::io::{self, Write, Read};
|
||||
//!
|
||||
//! # fn main() {
|
||||
//! # if let Err(_) = run() {
|
||||
//! # ::std::process::exit(1);
|
||||
//! # }
|
||||
//! # }
|
||||
//! # fn run() -> Result<(), io::Error> {
|
||||
//! let text = "Brian was here. Briefly.";
|
||||
//!
|
||||
//! // Create a file inside of `std::env::temp_dir()`.
|
||||
//! let mut file1 = NamedTempFile::new()?;
|
||||
//!
|
||||
//! // Re-open it.
|
||||
//! let mut file2 = file1.reopen()?;
|
||||
//!
|
||||
//! // Write some test data to the first handle.
|
||||
//! file1.write_all(text.as_bytes())?;
|
||||
//!
|
||||
//! // Read the test data using the second handle.
|
||||
//! let mut buf = String::new();
|
||||
//! file2.read_to_string(&mut buf)?;
|
||||
//! assert_eq!(buf, text);
|
||||
//! # Ok(())
|
||||
//! # }
|
||||
//! ```
|
||||
//!
|
||||
//! Create a temporary directory and add a file to it:
|
||||
//!
|
||||
//! ```
|
||||
//! # extern crate tempfile;
|
||||
//! use tempfile::tempdir;
|
||||
//! use std::fs::File;
|
||||
//! use std::io::{self, Write};
|
||||
@ -87,55 +117,51 @@
|
||||
//! [`NamedTempFile`]: struct.NamedTempFile.html
|
||||
//! [`std::env::temp_dir()`]: https://doc.rust-lang.org/std/env/fn.temp_dir.html
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://docs.rs/tempfile/2.2.0")]
|
||||
#![doc(
|
||||
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://docs.rs/tempfile/3.1.0"
|
||||
)]
|
||||
#![cfg_attr(test, deny(warnings))]
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate cfg_if;
|
||||
extern crate rand;
|
||||
extern crate remove_dir_all;
|
||||
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
|
||||
#[cfg(windows)]
|
||||
extern crate winapi;
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
extern crate syscall;
|
||||
|
||||
const NUM_RETRIES: u32 = 1 << 31;
|
||||
const NUM_RAND_CHARS: usize = 6;
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::OpenOptions;
|
||||
use std::path::Path;
|
||||
use std::{env, io};
|
||||
|
||||
mod error;
|
||||
mod dir;
|
||||
mod error;
|
||||
mod file;
|
||||
mod util;
|
||||
mod spooled;
|
||||
mod util;
|
||||
|
||||
pub use dir::{tempdir, tempdir_in, TempDir};
|
||||
pub use file::{tempfile, tempfile_in, NamedTempFile, PersistError, TempPath};
|
||||
pub use spooled::{spooled_tempfile, SpooledTempFile};
|
||||
pub use crate::dir::{tempdir, tempdir_in, TempDir};
|
||||
pub use crate::file::{tempfile, tempfile_in, NamedTempFile, PathPersistError, PersistError, TempPath};
|
||||
pub use crate::spooled::{spooled_tempfile, SpooledTempFile};
|
||||
|
||||
/// Create a new temporary file or directory with custom parameters.
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Builder<'a, 'b> {
|
||||
random_len: usize,
|
||||
prefix: &'a str,
|
||||
suffix: &'b str,
|
||||
prefix: &'a OsStr,
|
||||
suffix: &'b OsStr,
|
||||
append: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'b> Default for Builder<'a, 'b> {
|
||||
fn default() -> Self {
|
||||
Builder {
|
||||
random_len: ::NUM_RAND_CHARS,
|
||||
prefix: ".tmp",
|
||||
suffix: "",
|
||||
random_len: crate::NUM_RAND_CHARS,
|
||||
prefix: OsStr::new(".tmp"),
|
||||
suffix: OsStr::new(""),
|
||||
append: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -148,7 +174,6 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// Create a named temporary file and write some data into it:
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// # use std::ffi::OsStr;
|
||||
/// # fn main() {
|
||||
@ -181,7 +206,6 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// Create a temporary directory and add a file to it:
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io::{self, Write};
|
||||
/// # use std::fs::File;
|
||||
/// # use std::ffi::OsStr;
|
||||
@ -224,7 +248,6 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
@ -239,8 +262,8 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn prefix(&mut self, prefix: &'a str) -> &mut Self {
|
||||
self.prefix = prefix;
|
||||
pub fn prefix<S: AsRef<OsStr> + ?Sized>(&mut self, prefix: &'a S) -> &mut Self {
|
||||
self.prefix = prefix.as_ref();
|
||||
self
|
||||
}
|
||||
|
||||
@ -252,7 +275,6 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
@ -267,8 +289,8 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn suffix(&mut self, suffix: &'b str) -> &mut Self {
|
||||
self.suffix = suffix;
|
||||
pub fn suffix<S: AsRef<OsStr> + ?Sized>(&mut self, suffix: &'b S) -> &mut Self {
|
||||
self.suffix = suffix.as_ref();
|
||||
self
|
||||
}
|
||||
|
||||
@ -279,7 +301,6 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
@ -299,6 +320,32 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the file to be opened in append mode.
|
||||
///
|
||||
/// Default: `false`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use std::io;
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
/// # ::std::process::exit(1);
|
||||
/// # }
|
||||
/// # }
|
||||
/// # fn run() -> Result<(), io::Error> {
|
||||
/// # use tempfile::Builder;
|
||||
/// let named_tempfile = Builder::new()
|
||||
/// .append(true)
|
||||
/// .tempfile()?;
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn append(&mut self, append: bool) -> &mut Self {
|
||||
self.append = append;
|
||||
self
|
||||
}
|
||||
|
||||
/// Create the named temporary file.
|
||||
///
|
||||
/// # Security
|
||||
@ -316,7 +363,6 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
@ -353,7 +399,6 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// # use std::io;
|
||||
/// # fn main() {
|
||||
/// # if let Err(_) = run() {
|
||||
@ -375,7 +420,7 @@ impl<'a, 'b> Builder<'a, 'b> {
|
||||
self.prefix,
|
||||
self.suffix,
|
||||
self.random_len,
|
||||
file::create_named,
|
||||
|path| file::create_named(path, OpenOptions::new().append(self.append)),
|
||||
)
|
||||
}
|
||||
|
||||
|
11
third_party/rust/tempfile/src/spooled.rs
vendored
11
third_party/rust/tempfile/src/spooled.rs
vendored
@ -1,7 +1,6 @@
|
||||
use crate::file::tempfile;
|
||||
use std::fs::File;
|
||||
use std::io::{self, Read, Write, Seek, SeekFrom, Cursor};
|
||||
use file::tempfile;
|
||||
use std::mem::drop;
|
||||
use std::io::{self, Cursor, Read, Seek, SeekFrom, Write};
|
||||
|
||||
#[derive(Debug)]
|
||||
enum SpooledInner {
|
||||
@ -35,7 +34,6 @@ pub struct SpooledTempFile {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # extern crate tempfile;
|
||||
/// use tempfile::spooled_tempfile;
|
||||
/// use std::io::{self, Write};
|
||||
///
|
||||
@ -86,9 +84,8 @@ impl SpooledTempFile {
|
||||
if !self.is_rolled() {
|
||||
let mut file = tempfile()?;
|
||||
if let SpooledInner::InMemory(ref mut cursor) = self.inner {
|
||||
file.write(cursor.get_ref())?;
|
||||
file.write_all(cursor.get_ref())?;
|
||||
file.seek(SeekFrom::Start(cursor.position()))?;
|
||||
drop(cursor);
|
||||
}
|
||||
self.inner = SpooledInner::OnDisk(file);
|
||||
}
|
||||
@ -103,7 +100,7 @@ impl SpooledTempFile {
|
||||
SpooledInner::InMemory(ref mut cursor) => {
|
||||
cursor.get_mut().resize(size as usize, 0);
|
||||
Ok(())
|
||||
},
|
||||
}
|
||||
SpooledInner::OnDisk(ref mut file) => file.set_len(size),
|
||||
}
|
||||
}
|
||||
|
53
third_party/rust/tempfile/src/util.rs
vendored
53
third_party/rust/tempfile/src/util.rs
vendored
@ -1,45 +1,39 @@
|
||||
use rand;
|
||||
use rand::RngCore;
|
||||
use std::ffi::OsString;
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rand::{self, Rng};
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{io, iter};
|
||||
use std::{io, str};
|
||||
|
||||
use error::IoResultExt;
|
||||
use crate::error::IoResultExt;
|
||||
|
||||
fn tmpname(prefix: &str, suffix: &str, rand_len: usize) -> OsString {
|
||||
let mut buf = String::with_capacity(prefix.len() + suffix.len() + rand_len);
|
||||
buf.push_str(prefix);
|
||||
buf.extend(iter::repeat('X').take(rand_len));
|
||||
buf.push_str(suffix);
|
||||
fn tmpname(prefix: &OsStr, suffix: &OsStr, rand_len: usize) -> OsString {
|
||||
let mut buf = OsString::with_capacity(prefix.len() + suffix.len() + rand_len);
|
||||
buf.push(prefix);
|
||||
|
||||
// Randomize.
|
||||
// Push each character in one-by-one. Unfortunately, this is the only
|
||||
// safe(ish) simple way to do this without allocating a temporary
|
||||
// String/Vec.
|
||||
unsafe {
|
||||
// We guarantee utf8.
|
||||
let bytes = &mut buf.as_mut_vec()[prefix.len()..prefix.len() + rand_len];
|
||||
rand::thread_rng().fill_bytes(bytes);
|
||||
for byte in bytes.iter_mut() {
|
||||
*byte = match *byte % 62 {
|
||||
v @ 0...9 => (v + b'0'),
|
||||
v @ 10...35 => (v - 10 + b'a'),
|
||||
v @ 36...61 => (v - 36 + b'A'),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
rand::thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(rand_len)
|
||||
.for_each(|b| buf.push(str::from_utf8_unchecked(&[b as u8])))
|
||||
}
|
||||
OsString::from(buf)
|
||||
buf.push(suffix);
|
||||
buf
|
||||
}
|
||||
|
||||
pub fn create_helper<F, R>(
|
||||
base: &Path,
|
||||
prefix: &str,
|
||||
suffix: &str,
|
||||
prefix: &OsStr,
|
||||
suffix: &OsStr,
|
||||
random_len: usize,
|
||||
f: F,
|
||||
) -> io::Result<R>
|
||||
where
|
||||
F: Fn(PathBuf) -> io::Result<R>,
|
||||
{
|
||||
let num_retries = if random_len != 0 { ::NUM_RETRIES } else { 1 };
|
||||
let num_retries = if random_len != 0 { crate::NUM_RETRIES } else { 1 };
|
||||
|
||||
for _ in 0..num_retries {
|
||||
let path = base.join(tmpname(prefix, suffix, random_len));
|
||||
@ -50,7 +44,8 @@ where
|
||||
}
|
||||
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::AlreadyExists,
|
||||
"too many temporary files exist"))
|
||||
.with_err_path(|| base)
|
||||
io::ErrorKind::AlreadyExists,
|
||||
"too many temporary files exist",
|
||||
))
|
||||
.with_err_path(|| base)
|
||||
}
|
||||
|
82
third_party/rust/tempfile/tests/namedtempfile.rs
vendored
82
third_party/rust/tempfile/tests/namedtempfile.rs
vendored
@ -1,4 +1,5 @@
|
||||
extern crate tempfile;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
@ -95,6 +96,19 @@ fn test_customnamed() {
|
||||
assert_eq!(name.len(), 18);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_append() {
|
||||
let mut tmpfile = Builder::new().append(true).tempfile().unwrap();
|
||||
tmpfile.write(b"a").unwrap();
|
||||
tmpfile.seek(SeekFrom::Start(0)).unwrap();
|
||||
tmpfile.write(b"b").unwrap();
|
||||
|
||||
tmpfile.seek(SeekFrom::Start(0)).unwrap();
|
||||
let mut buf = vec![0u8; 1];
|
||||
tmpfile.read_exact(&mut buf).unwrap();
|
||||
assert_eq!(buf, b"a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reopen() {
|
||||
let source = NamedTempFile::new().unwrap();
|
||||
@ -201,3 +215,69 @@ fn test_temppath_persist_noclobber() {
|
||||
assert_eq!("abcde", buf);
|
||||
std::fs::remove_file(&persist_path).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_write_after_close() {
|
||||
let path = NamedTempFile::new().unwrap().into_temp_path();
|
||||
File::create(path).unwrap().write_all(b"test").unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_change_dir() {
|
||||
env::set_current_dir(env::temp_dir()).unwrap();
|
||||
let tmpfile = NamedTempFile::new_in(".").unwrap();
|
||||
let path = env::current_dir().unwrap().join(tmpfile.path());
|
||||
env::set_current_dir("/").unwrap();
|
||||
drop(tmpfile);
|
||||
assert!(!exists(path))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_parts() {
|
||||
let mut file = NamedTempFile::new().unwrap();
|
||||
write!(file, "abcd").expect("write failed");
|
||||
|
||||
let (mut file, temp_path) = file.into_parts();
|
||||
|
||||
let path = temp_path.to_path_buf();
|
||||
|
||||
assert!(path.exists());
|
||||
drop(temp_path);
|
||||
assert!(!path.exists());
|
||||
|
||||
write!(file, "efgh").expect("write failed");
|
||||
|
||||
file.seek(SeekFrom::Start(0)).unwrap();
|
||||
let mut buf = String::new();
|
||||
file.read_to_string(&mut buf).unwrap();
|
||||
assert_eq!("abcdefgh", buf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keep() {
|
||||
let mut tmpfile = NamedTempFile::new().unwrap();
|
||||
write!(tmpfile, "abcde").unwrap();
|
||||
let (mut f, temp_path) = tmpfile.into_parts();
|
||||
let path;
|
||||
{
|
||||
assert!(exists(&temp_path));
|
||||
path = temp_path.keep().unwrap();
|
||||
assert!(exists(&path));
|
||||
|
||||
// Check original file
|
||||
f.seek(SeekFrom::Start(0)).unwrap();
|
||||
let mut buf = String::new();
|
||||
f.read_to_string(&mut buf).unwrap();
|
||||
assert_eq!("abcde", buf);
|
||||
}
|
||||
|
||||
{
|
||||
// Try opening it again.
|
||||
let mut f = File::open(&path).unwrap();
|
||||
f.seek(SeekFrom::Start(0)).unwrap();
|
||||
let mut buf = String::new();
|
||||
f.read_to_string(&mut buf).unwrap();
|
||||
assert_eq!("abcde", buf);
|
||||
}
|
||||
std::fs::remove_file(&path).unwrap();
|
||||
}
|
||||
|
9
third_party/rust/tempfile/tests/spooled.rs
vendored
9
third_party/rust/tempfile/tests/spooled.rs
vendored
@ -1,6 +1,6 @@
|
||||
extern crate tempfile;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
use std::io::{Write, Seek, Read, SeekFrom};
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
|
||||
use tempfile::{spooled_tempfile, SpooledTempFile};
|
||||
|
||||
@ -265,7 +265,10 @@ fn test_set_len(t: &mut SpooledTempFile) {
|
||||
assert_eq!(t.seek(SeekFrom::Current(0)).unwrap(), 10); // tell()
|
||||
assert_eq!(t.seek(SeekFrom::Start(0)).unwrap(), 0);
|
||||
assert_eq!(t.read_to_end(&mut buf).unwrap(), 40);
|
||||
assert_eq!(buf.as_slice(), &b"abcdefghij\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"[..]);
|
||||
assert_eq!(
|
||||
buf.as_slice(),
|
||||
&b"abcdefghij\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"[..]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
5
third_party/rust/tempfile/tests/tempdir.rs
vendored
5
third_party/rust/tempfile/tests/tempdir.rs
vendored
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern crate tempfile;
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
@ -222,7 +222,8 @@ pub fn dont_double_panic() {
|
||||
// Panic. If TempDir panics *again* due to the rmdir
|
||||
// error then the process will abort.
|
||||
panic!();
|
||||
}).join();
|
||||
})
|
||||
.join();
|
||||
assert!(r.is_err());
|
||||
}
|
||||
|
||||
|
7
third_party/rust/tempfile/tests/tempfile.rs
vendored
7
third_party/rust/tempfile/tests/tempfile.rs
vendored
@ -1,8 +1,9 @@
|
||||
extern crate tempfile;
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
#![deny(rust_2018_idioms)]
|
||||
|
||||
use std::fs;
|
||||
use std::thread;
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
use std::sync::mpsc::{sync_channel, TryRecvError};
|
||||
use std::thread;
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"CHANGELOG.md":"6ad11e637128d85c31cb2653ed43ab7dde487a4abd81555f51407cc7e28af2ad","Cargo.toml":"a94adb1436925175ab89cddc8455c9122a10292b6a01d22fb4c74625a07638b3","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"a51e263f8fb923075df065969b145a12d550416d8a88527f586d45c9c67d8dc7","src/enter.rs":"a1486e463c9bf4231a2222c8bd72ad64c8ce4f6b434bdf42c36b226ead6e6208","src/error.rs":"142ec440d9bd6a500ea58fbcfe7c1a80aef699fa00c9a451b7cf4b237c03b0a1","src/executor.rs":"9e334b17c4476f42a7500930172b40c9bf3ad8d62471f3772093db2293638c35","src/global.rs":"7246812b8eaee5d6ae260a38d3b13003d6d093fa381ee037386fa3c2ae3c965d","src/lib.rs":"aa3c3ba929b928f0beb96897b604e91fe684d4c094a4e027332b50d3e4223882","src/park.rs":"f06524a1582f5bc4bf7edb19a5b4dacf59909fa1a788c70f4b08c75ac6d02b36","src/typed.rs":"0068829ab9429f51651bab97e066c970665e4a418a56bc62946a0d0e29c2e71b","tests/executor.rs":"c3bb94812a58e18b542a98dfd30b90c6e84842a8d1b8ede1a4dd8f9622bd382f"},"package":"83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e"}
|
||||
{"files":{"CHANGELOG.md":"95eeaa7acd4fc1203637784a611d1202e5e5d6c644cb1c4f4d3c8b0da42ea920","Cargo.toml":"651887528b10435036b410b87f5a95edde0159ff4923102f92b1902f6b778a33","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"28d453f140f96a9bc110aab49854a3dbc67d17b8302d3203aaf78d74f6bc8f04","src/enter.rs":"fd96bb8f3fcd621cbbde99cd15cdcfff65d0d8f10fb22bbe01e95453af76bf01","src/error.rs":"142ec440d9bd6a500ea58fbcfe7c1a80aef699fa00c9a451b7cf4b237c03b0a1","src/executor.rs":"c8fce212c14f3e07aa1076023df0e4ee2290a65efa838e5f4fb0ab271e66c379","src/global.rs":"a6979e156b1e2989b872ded3b5965773545ce736da2891c46bf5da714ef6837c","src/lib.rs":"26689bd517d5b97996e06e4c777e47f29b89447a067de7223c45538ed50690a1","src/park.rs":"6d590f4ef8c161fd51b33e583cf014e4b53ef81d974663d76d4827b150938327","src/typed.rs":"0068829ab9429f51651bab97e066c970665e4a418a56bc62946a0d0e29c2e71b","tests/executor.rs":"ff891380e285651a11f87610b46ab7f9c88c0b67a390b43316b7c03df463df51"},"package":"ca6df436c42b0c3330a82d855d2ef017cd793090ad550a6bc2184f4b933532ab"}
|
11
third_party/rust/tokio-executor/CHANGELOG.md
vendored
11
third_party/rust/tokio-executor/CHANGELOG.md
vendored
@ -1,3 +1,14 @@
|
||||
# 0.1.9 (November 27, 2019)
|
||||
|
||||
### Added
|
||||
- Add `executor::set_default` which behaves like `with_default` but returns a
|
||||
drop guard (#1725).
|
||||
|
||||
# 0.1.8 (June 2, 2019)
|
||||
|
||||
### Added
|
||||
- Add `executor::exit` to allow other executors inside `threadpool::blocking` (#1155).
|
||||
|
||||
# 0.1.7 (March 22, 2019)
|
||||
|
||||
### Added
|
||||
|
8
third_party/rust/tokio-executor/Cargo.toml
vendored
8
third_party/rust/tokio-executor/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,11 +12,11 @@
|
||||
|
||||
[package]
|
||||
name = "tokio-executor"
|
||||
version = "0.1.7"
|
||||
version = "0.1.9"
|
||||
authors = ["Carl Lerche <me@carllerche.com>"]
|
||||
description = "Future execution primitives\n"
|
||||
homepage = "https://github.com/tokio-rs/tokio"
|
||||
documentation = "https://docs.rs/tokio-executor/0.1.7/tokio_executor"
|
||||
documentation = "https://docs.rs/tokio-executor/0.1.9/tokio_executor"
|
||||
keywords = ["futures", "tokio"]
|
||||
categories = ["concurrency", "asynchronous"]
|
||||
license = "MIT"
|
||||
@ -27,4 +27,4 @@ version = "0.6.2"
|
||||
[dependencies.futures]
|
||||
version = "0.1.19"
|
||||
[dev-dependencies.tokio]
|
||||
version = "0.1.17"
|
||||
version = "0.1.18"
|
||||
|
10
third_party/rust/tokio-executor/README.md
vendored
10
third_party/rust/tokio-executor/README.md
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
Task execution related traits and utilities.
|
||||
|
||||
[Documentation](https://docs.rs/tokio-executor/0.1.7/tokio_executor)
|
||||
[Documentation](https://docs.rs/tokio-executor/0.1.9/tokio_executor)
|
||||
|
||||
## Overview
|
||||
|
||||
@ -31,10 +31,10 @@ executor, including:
|
||||
|
||||
* [`Park`] abstracts over blocking and unblocking the current thread.
|
||||
|
||||
[`Executor`]: https://docs.rs/tokio-executor/0.1.7/tokio_executor/trait.Executor.html
|
||||
[`enter`]: https://docs.rs/tokio-executor/0.1.7/tokio_executor/fn.enter.html
|
||||
[`DefaultExecutor`]: https://docs.rs/tokio-executor/0.1.7/tokio_executor/struct.DefaultExecutor.html
|
||||
[`Park`]: https://docs.rs/tokio-executor/0.1.7/tokio_executor/park/trait.Park.html
|
||||
[`Executor`]: https://docs.rs/tokio-executor/0.1.9/tokio_executor/trait.Executor.html
|
||||
[`enter`]: https://docs.rs/tokio-executor/0.1.9/tokio_executor/fn.enter.html
|
||||
[`DefaultExecutor`]: https://docs.rs/tokio-executor/0.1.9/tokio_executor/struct.DefaultExecutor.html
|
||||
[`Park`]: https://docs.rs/tokio-executor/0.1.9/tokio_executor/park/trait.Park.html
|
||||
|
||||
## License
|
||||
|
||||
|
38
third_party/rust/tokio-executor/src/enter.rs
vendored
38
third_party/rust/tokio-executor/src/enter.rs
vendored
@ -11,7 +11,7 @@ thread_local!(static ENTERED: Cell<bool> = Cell::new(false));
|
||||
///
|
||||
/// For more details, see [`enter` documentation](fn.enter.html)
|
||||
pub struct Enter {
|
||||
on_exit: Vec<Box<Callback>>,
|
||||
on_exit: Vec<Box<dyn Callback>>,
|
||||
permanent: bool,
|
||||
}
|
||||
|
||||
@ -67,6 +67,42 @@ pub fn enter() -> Result<Enter, EnterError> {
|
||||
})
|
||||
}
|
||||
|
||||
// Forces the current "entered" state to be cleared while the closure
|
||||
// is executed.
|
||||
//
|
||||
// # Warning
|
||||
//
|
||||
// This is hidden for a reason. Do not use without fully understanding
|
||||
// executors. Misuing can easily cause your program to deadlock.
|
||||
#[doc(hidden)]
|
||||
pub fn exit<F: FnOnce() -> R, R>(f: F) -> R {
|
||||
// Reset in case the closure panics
|
||||
struct Reset;
|
||||
impl Drop for Reset {
|
||||
fn drop(&mut self) {
|
||||
ENTERED.with(|c| {
|
||||
c.set(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ENTERED.with(|c| {
|
||||
debug_assert!(c.get());
|
||||
c.set(false);
|
||||
});
|
||||
|
||||
let reset = Reset;
|
||||
let ret = f();
|
||||
::std::mem::forget(reset);
|
||||
|
||||
ENTERED.with(|c| {
|
||||
assert!(!c.get(), "closure claimed permanent executor");
|
||||
c.set(true);
|
||||
});
|
||||
|
||||
ret
|
||||
}
|
||||
|
||||
impl Enter {
|
||||
/// Register a callback to be invoked if and when the thread
|
||||
/// ceased to act as an executor.
|
||||
|
@ -94,7 +94,7 @@ pub trait Executor {
|
||||
/// ```
|
||||
fn spawn(
|
||||
&mut self,
|
||||
future: Box<Future<Item = (), Error = ()> + Send>,
|
||||
future: Box<dyn Future<Item = (), Error = ()> + Send>,
|
||||
) -> Result<(), SpawnError>;
|
||||
|
||||
/// Provides a best effort **hint** to whether or not `spawn` will succeed.
|
||||
@ -140,7 +140,7 @@ pub trait Executor {
|
||||
impl<E: Executor + ?Sized> Executor for Box<E> {
|
||||
fn spawn(
|
||||
&mut self,
|
||||
future: Box<Future<Item = (), Error = ()> + Send>,
|
||||
future: Box<dyn Future<Item = (), Error = ()> + Send>,
|
||||
) -> Result<(), SpawnError> {
|
||||
(**self).spawn(future)
|
||||
}
|
||||
|
62
third_party/rust/tokio-executor/src/global.rs
vendored
62
third_party/rust/tokio-executor/src/global.rs
vendored
@ -19,6 +19,13 @@ pub struct DefaultExecutor {
|
||||
_dummy: (),
|
||||
}
|
||||
|
||||
/// Ensures that the executor is removed from the thread-local context
|
||||
/// when leaving the scope. This handles cases that involve panicking.
|
||||
#[derive(Debug)]
|
||||
pub struct DefaultGuard {
|
||||
_p: (),
|
||||
}
|
||||
|
||||
impl DefaultExecutor {
|
||||
/// Returns a handle to the default executor for the current context.
|
||||
///
|
||||
@ -37,7 +44,7 @@ impl DefaultExecutor {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn with_current<F: FnOnce(&mut Executor) -> R, R>(f: F) -> Option<R> {
|
||||
fn with_current<F: FnOnce(&mut dyn Executor) -> R, R>(f: F) -> Option<R> {
|
||||
EXECUTOR.with(
|
||||
|current_executor| match current_executor.replace(State::Active) {
|
||||
State::Ready(executor_ptr) => {
|
||||
@ -57,7 +64,7 @@ enum State {
|
||||
// default executor not defined
|
||||
Empty,
|
||||
// default executor is defined and ready to be used
|
||||
Ready(*mut Executor),
|
||||
Ready(*mut dyn Executor),
|
||||
// default executor is currently active (used to detect recursive calls)
|
||||
Active,
|
||||
}
|
||||
@ -72,7 +79,7 @@ thread_local! {
|
||||
impl super::Executor for DefaultExecutor {
|
||||
fn spawn(
|
||||
&mut self,
|
||||
future: Box<Future<Item = (), Error = ()> + Send>,
|
||||
future: Box<dyn Future<Item = (), Error = ()> + Send>,
|
||||
) -> Result<(), SpawnError> {
|
||||
DefaultExecutor::with_current(|executor| executor.spawn(future))
|
||||
.unwrap_or_else(|| Err(SpawnError::shutdown()))
|
||||
@ -175,6 +182,11 @@ where
|
||||
T: Executor,
|
||||
F: FnOnce(&mut Enter) -> R,
|
||||
{
|
||||
unsafe fn hide_lt<'a>(p: *mut (dyn Executor + 'a)) -> *mut (dyn Executor + 'static) {
|
||||
use std::mem;
|
||||
mem::transmute(p)
|
||||
}
|
||||
|
||||
EXECUTOR.with(|cell| {
|
||||
match cell.get() {
|
||||
State::Ready(_) | State::Active => {
|
||||
@ -210,9 +222,47 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
unsafe fn hide_lt<'a>(p: *mut (Executor + 'a)) -> *mut (Executor + 'static) {
|
||||
use std::mem;
|
||||
mem::transmute(p)
|
||||
/// Sets `executor` as the default executor, returning a guard that unsets it when
|
||||
/// dropped.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This function panics if there already is a default executor set.
|
||||
pub fn set_default<T>(executor: T) -> DefaultGuard
|
||||
where
|
||||
T: Executor + 'static,
|
||||
{
|
||||
EXECUTOR.with(|cell| {
|
||||
match cell.get() {
|
||||
State::Ready(_) | State::Active => {
|
||||
panic!("default executor already set for execution context")
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Ensure that the executor will outlive the call to set_default, even
|
||||
// if the drop guard is never dropped due to calls to `mem::forget` or
|
||||
// similar.
|
||||
let executor = Box::new(executor);
|
||||
|
||||
cell.set(State::Ready(Box::into_raw(executor)));
|
||||
});
|
||||
|
||||
DefaultGuard { _p: () }
|
||||
}
|
||||
|
||||
impl Drop for DefaultGuard {
|
||||
fn drop(&mut self) {
|
||||
let _ = EXECUTOR.try_with(|cell| {
|
||||
if let State::Ready(prev) = cell.replace(State::Empty) {
|
||||
// drop the previous executor.
|
||||
unsafe {
|
||||
let prev = Box::from_raw(prev);
|
||||
drop(prev);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
8
third_party/rust/tokio-executor/src/lib.rs
vendored
8
third_party/rust/tokio-executor/src/lib.rs
vendored
@ -1,5 +1,5 @@
|
||||
#![deny(missing_docs, missing_debug_implementations, warnings)]
|
||||
#![doc(html_root_url = "https://docs.rs/tokio-executor/0.1.7")]
|
||||
#![deny(missing_docs, missing_debug_implementations)]
|
||||
#![doc(html_root_url = "https://docs.rs/tokio-executor/0.1.9")]
|
||||
|
||||
//! Task execution related traits and utilities.
|
||||
//!
|
||||
@ -61,8 +61,8 @@ mod global;
|
||||
pub mod park;
|
||||
mod typed;
|
||||
|
||||
pub use enter::{enter, Enter, EnterError};
|
||||
pub use enter::{enter, exit, Enter, EnterError};
|
||||
pub use error::SpawnError;
|
||||
pub use executor::Executor;
|
||||
pub use global::{spawn, with_default, DefaultExecutor};
|
||||
pub use global::{set_default, spawn, with_default, DefaultExecutor, DefaultGuard};
|
||||
pub use typed::TypedExecutor;
|
||||
|
4
third_party/rust/tokio-executor/src/park.rs
vendored
4
third_party/rust/tokio-executor/src/park.rs
vendored
@ -128,13 +128,13 @@ pub trait Unpark: Sync + Send + 'static {
|
||||
fn unpark(&self);
|
||||
}
|
||||
|
||||
impl Unpark for Box<Unpark> {
|
||||
impl Unpark for Box<dyn Unpark> {
|
||||
fn unpark(&self) {
|
||||
(**self).unpark()
|
||||
}
|
||||
}
|
||||
|
||||
impl Unpark for Arc<Unpark> {
|
||||
impl Unpark for Arc<dyn Unpark> {
|
||||
fn unpark(&self) {
|
||||
(**self).unpark()
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ mod out_of_executor_context {
|
||||
|
||||
fn test<F, E>(spawn: F)
|
||||
where
|
||||
F: Fn(Box<Future<Item = (), Error = ()> + Send>) -> Result<(), E>,
|
||||
F: Fn(Box<dyn Future<Item = (), Error = ()> + Send>) -> Result<(), E>,
|
||||
{
|
||||
let res = spawn(Box::new(lazy(|| Ok(()))));
|
||||
assert!(res.is_err());
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"CHANGELOG.md":"cb22ed0ab56d9e692a321d701286a9bf7b9627fe80f9f767c81f7f8d85baac9e","Cargo.toml":"812c3b7526c0a3a7aca542993a8e1c7a45ea5405866cfed9d6cedfac2a86145f","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"0224261441ddc28afa496e27e6be7ea13650c3c18355ac6e86602100cf5faebd","benches/basic.rs":"e54b01ccffd8ecba3a864bb7b01c323497ea909a5d2bf1caf41b2dd4791be524","benches/blocking.rs":"e79b3fc1517453f0de041a0c77d1278b2249d969e87ffbd7db6d7b55dfb2f0e2","benches/depth.rs":"7884ba7ad073d4ec9a0432a5e7dc3d6fd9ad52a434ebfcd4764bbbf04a32f28d","examples/depth.rs":"66e1548e3b22c4f4db231e1f56e7d760fbb2afba631022d934adc2843b089a6d","examples/hello.rs":"3dcd089b9103abf96b65ae1e86c02af14a10924aae1a5bf0772229360c9f9a61","src/blocking.rs":"dc0d1a7aad59ca3252825687452e8aad923fce4011c957fad192613cc206ecc4","src/builder.rs":"da7ba6f0a63c2a236966abad8c38189db23b5479f17d5966713c4730863a0cbe","src/callback.rs":"c0439e816c218474ef59d65ea31f02b2326854d10e7978399688c4015c04b9f8","src/config.rs":"ae8d7aa8fe8b2192bbbae8d7fe43fe89de05a7eeebbcd967a2b5d2cff145f05c","src/lib.rs":"65c0947108b528c5f7afd2c3661c6311be669146738c030e79be455d3abd17ea","src/notifier.rs":"3f127a0495958f47ef747f537923da49adf080e74577dcd209da7db8a8549406","src/park/boxed.rs":"f47f000d946aeb08e7a57f5003d8d8d4bcbf1c7db571aa1ffef1778033b6fcc4","src/park/default_park.rs":"b215774f69cdf141f4795906b35b5b76f5b2516ff6edbe382d490c940a7dfcca","src/park/mod.rs":"63b391ff690d98088bf586278e0b9c735cb551472c0fc85bc0238433bd0aad76","src/pool/backup.rs":"5782cb9c3513a2b4302aa586390e898e32f10bdd7717bc282a77e95ef8ad225f","src/pool/backup_stack.rs":"e7e8a1bdf1040965b7d95c1b04e0d1959480729d82dee3bd2fea2f2190063203","src/pool/mod.rs":"5700a3c27a89990637cf95554e7f91cbc914ef50ca4aa6f435ad60a1ce774c0c","src/pool/state.rs":"474e8b30328f386fe6bda36b469c9f8590d1eb6dc525325254f1a1b3cf2923f3","src/sender.rs":"e6bdfbb05d664665ada24b4b532ed64b5794a1d37c2ecf8213a7d11fc0edcdee","src/shutdown.rs":"94cd086cffb0dc86a338226f47be549e148a6a44f707ed3fc5ed1334a0d2cb7d","src/task/blocking.rs":"04a24d2d5505593f1172aab5a4ba903736d6630afd658c15a9f0b3252599a6c0","src/task/blocking_state.rs":"4116e314417b53608947374ce243e116596383b2f0c8728a5814f7d73fcc574d","src/task/mod.rs":"343febac2287151cc11ad37480015376366632e3e6c27c018b09a25414f3ed91","src/task/state.rs":"8f90e419e50ab862be6d7c0ef34c6b1cc50c0e020b4fc8297ac1680b630db7ed","src/thread_pool.rs":"fc039328a70800570421b68d9f4790b30120e5b6629a1a4a7e47218b7cb8b7eb","src/worker/entry.rs":"126bc91b41ef728a423b9d6b0728ae135be15256e03106566908e3b7f158c956","src/worker/mod.rs":"5b80dedb308503bb6007d77d1f10f0889d05d15aa3a26d68f2d7a92d31629d15","src/worker/stack.rs":"7e40d40fdef023ea0dfdf076a1b68e3aa56eaf32f6bf3de546d557321650787f","src/worker/state.rs":"0aba1be55c52f0e69db249ef986b2db50b493de65b7a8ff8dd2af29b192c8ade","tests/blocking.rs":"687dc500d18b19a4d1f91345ccaa0908dcc3cff2ed97d1acf8b088459dd51943","tests/hammer.rs":"fe3371ca3b1a7f5eeedb4bca619090b0a90fe0dca46fda8aadd761b847ed6a0a","tests/threadpool.rs":"d3970b8e0975db7538da142f214d80e7a9af8f9a592f2730136c82ea0795dd79"},"package":"72558af20be886ea124595ea0f806dd5703b8958e4705429dd58b3d8231f72f2"}
|
||||
{"files":{"CHANGELOG.md":"6c6384e964eb407567182ff80e9eea32b597df599f387cd1c5991479716bf68f","Cargo.lock":"557a52b0b51573b515fceb1ff91ccf838a010fae7d5d840671ef03c35453ffd6","Cargo.toml":"50a9f8055b0c10352ba0212ff719d45e4f0f71aaa95eda2df1a3e1f6e3ac40bd","LICENSE":"898b1ae9821e98daf8964c8d6c7f61641f5f5aa78ad500020771c0939ee0dea1","README.md":"87c45bc5ea9337e0048e1ecbc6fd31d485396c12ca041816d728fee7df8dba3a","benches/basic.rs":"2ddbbba8fe38ded4ff2bcf57d0440905dfccafb56e3ef3e1ca31f5ce2f752fd1","benches/blocking.rs":"5f0b14d8fdfadd9e8503fe73a9616112b5eb274ccf10fc5343164648ddc28c6b","benches/depth.rs":"4c5b7a616273591b0dd68860d939be5383f7abf9fc1a3b06954ecbb32106d4a4","examples/depth.rs":"66e1548e3b22c4f4db231e1f56e7d760fbb2afba631022d934adc2843b089a6d","examples/hello.rs":"3dcd089b9103abf96b65ae1e86c02af14a10924aae1a5bf0772229360c9f9a61","src/blocking/global.rs":"9397f8bb44bb651619ad74fce96f44c6d7b4bde86e0f5478f4948212c4b8e501","src/blocking/mod.rs":"25e30ba6d263d9c51117d760ca53da8b0ceedc4d23638e236389c57789088b8b","src/builder.rs":"5ef2077f34b793641a3e72ac739f8f8d49fb72f6028faf8f9c436214474ae95b","src/callback.rs":"1de9db5541545d0a53245c928706715d34f9c5931c91223ad5de4b691be00ab7","src/config.rs":"6e7c470e8639df7eab03b5f504e3cede5787920c87011e63dc4497390a618406","src/lib.rs":"a00bd8fbfdac2067d57d6b3759352282d48529cc5a7d6417ed31fef3b11fe925","src/notifier.rs":"3f127a0495958f47ef747f537923da49adf080e74577dcd209da7db8a8549406","src/park/boxed.rs":"b1b98737f2ff20f1cfda44c42de14e5caf9bfe436ac85a116368fd1d7327c77a","src/park/default_park.rs":"b215774f69cdf141f4795906b35b5b76f5b2516ff6edbe382d490c940a7dfcca","src/park/mod.rs":"63b391ff690d98088bf586278e0b9c735cb551472c0fc85bc0238433bd0aad76","src/pool/backup.rs":"5782cb9c3513a2b4302aa586390e898e32f10bdd7717bc282a77e95ef8ad225f","src/pool/backup_stack.rs":"e7e8a1bdf1040965b7d95c1b04e0d1959480729d82dee3bd2fea2f2190063203","src/pool/mod.rs":"ce5ea1beed38bcef52be7070a3dac9888f4805bd090ab679396ea2e7e2d5f248","src/pool/state.rs":"474e8b30328f386fe6bda36b469c9f8590d1eb6dc525325254f1a1b3cf2923f3","src/sender.rs":"c5563a2d81f2ebe7dc77cd4caed2c1b0b95b0774d4b5dff3a20c4ad6d2107a7a","src/shutdown.rs":"94cd086cffb0dc86a338226f47be549e148a6a44f707ed3fc5ed1334a0d2cb7d","src/task/blocking.rs":"04a24d2d5505593f1172aab5a4ba903736d6630afd658c15a9f0b3252599a6c0","src/task/blocking_state.rs":"4116e314417b53608947374ce243e116596383b2f0c8728a5814f7d73fcc574d","src/task/mod.rs":"f3d854026cd1f6c8d1b6c116f79945a14554f10da4300fdc6acf31fa9a7b99b1","src/task/state.rs":"8f90e419e50ab862be6d7c0ef34c6b1cc50c0e020b4fc8297ac1680b630db7ed","src/thread_pool.rs":"fc039328a70800570421b68d9f4790b30120e5b6629a1a4a7e47218b7cb8b7eb","src/worker/entry.rs":"126bc91b41ef728a423b9d6b0728ae135be15256e03106566908e3b7f158c956","src/worker/mod.rs":"5b80dedb308503bb6007d77d1f10f0889d05d15aa3a26d68f2d7a92d31629d15","src/worker/stack.rs":"7e40d40fdef023ea0dfdf076a1b68e3aa56eaf32f6bf3de546d557321650787f","src/worker/state.rs":"0aba1be55c52f0e69db249ef986b2db50b493de65b7a8ff8dd2af29b192c8ade","tests/blocking.rs":"00467e3bba6c0d0a66ed82d876ffadded022b6fde5dabd9d7c92b9243cc9968c","tests/hammer.rs":"fe3371ca3b1a7f5eeedb4bca619090b0a90fe0dca46fda8aadd761b847ed6a0a","tests/threadpool.rs":"5bb7989ea4ca4f596938f7bacaf3dd3ebf54349dbc6d0d03da1f003867f11206"},"package":"f0c32ffea4827978e9aa392d2f743d973c1dfa3730a2ed3f22ce1e6984da848c"}
|
18
third_party/rust/tokio-threadpool/CHANGELOG.md
vendored
18
third_party/rust/tokio-threadpool/CHANGELOG.md
vendored
@ -1,3 +1,21 @@
|
||||
# 0.1.17 (December 3, 2019)
|
||||
|
||||
### Added
|
||||
- Internal APIs for overriding blocking behavior (#1752)
|
||||
|
||||
# 0.1.16 (September 25, 2019)
|
||||
|
||||
### Changed
|
||||
- Remove last non-dev dependency on rand crate by seeding PRNG via libstd
|
||||
`RandomState` (#1324 backport)
|
||||
- Upgrade (dev-only dependency) rand to 0.7.0 (#1302 backport)
|
||||
- The minimum supported rust version (MSRV) is now 1.31.0 (#1358)
|
||||
|
||||
# 0.1.15 (June 2, 2019)
|
||||
|
||||
### Changed
|
||||
- Allow other executors inside `threadpool::blocking` (#1155).
|
||||
|
||||
# 0.1.14 (April 22, 2019)
|
||||
|
||||
### Added
|
||||
|
290
third_party/rust/tokio-threadpool/Cargo.lock
generated
vendored
Normal file
290
third_party/rust/tokio-threadpool/Cargo.lock
generated
vendored
Normal file
@ -0,0 +1,290 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "c2-chacha"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "futures-cpupool"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "threadpool"
|
||||
version = "1.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-executor"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-threadpool"
|
||||
version = "0.1.17"
|
||||
dependencies = [
|
||||
"crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||
"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca"
|
||||
"checksum crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac"
|
||||
"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
|
||||
"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
|
||||
"checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4"
|
||||
"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
|
||||
"checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
|
||||
"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4"
|
||||
"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
|
||||
"checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9"
|
||||
"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72"
|
||||
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
|
||||
"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412"
|
||||
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
|
||||
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
|
||||
"checksum tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ca6df436c42b0c3330a82d855d2ef017cd793090ad550a6bc2184f4b933532ab"
|
||||
"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
|
20
third_party/rust/tokio-threadpool/Cargo.toml
vendored
20
third_party/rust/tokio-threadpool/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,11 +12,11 @@
|
||||
|
||||
[package]
|
||||
name = "tokio-threadpool"
|
||||
version = "0.1.14"
|
||||
version = "0.1.17"
|
||||
authors = ["Carl Lerche <me@carllerche.com>"]
|
||||
description = "A task scheduler backed by a work-stealing thread pool.\n"
|
||||
homepage = "https://github.com/tokio-rs/tokio"
|
||||
documentation = "https://docs.rs/tokio-threadpool/0.1.14/tokio_threadpool"
|
||||
documentation = "https://docs.rs/tokio-threadpool/0.1.17/tokio_threadpool"
|
||||
keywords = ["futures", "tokio"]
|
||||
categories = ["concurrency", "asynchronous"]
|
||||
license = "MIT"
|
||||
@ -33,25 +33,29 @@ version = "0.6.4"
|
||||
[dependencies.futures]
|
||||
version = "0.1.19"
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "1"
|
||||
|
||||
[dependencies.log]
|
||||
version = "0.4"
|
||||
|
||||
[dependencies.num_cpus]
|
||||
version = "1.2"
|
||||
|
||||
[dependencies.rand]
|
||||
version = "0.6"
|
||||
|
||||
[dependencies.slab]
|
||||
version = "0.4.1"
|
||||
|
||||
[dependencies.tokio-executor]
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
[dev-dependencies.env_logger]
|
||||
version = "0.5"
|
||||
version = "0.6"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.futures-cpupool]
|
||||
version = "0.1.7"
|
||||
|
||||
[dev-dependencies.rand]
|
||||
version = "0.7"
|
||||
|
||||
[dev-dependencies.threadpool]
|
||||
version = "1.7.1"
|
||||
|
2
third_party/rust/tokio-threadpool/README.md
vendored
2
third_party/rust/tokio-threadpool/README.md
vendored
@ -3,7 +3,7 @@
|
||||
A library for scheduling execution of futures concurrently across a pool of
|
||||
threads.
|
||||
|
||||
[Documentation](https://docs.rs/tokio-threadpool/0.1.14/tokio_threadpool)
|
||||
[Documentation](https://docs.rs/tokio-threadpool/0.1.17/tokio_threadpool)
|
||||
|
||||
### Why not Rayon?
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(test)]
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate futures;
|
||||
extern crate futures_cpupool;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(test)]
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate futures;
|
||||
extern crate rand;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(test)]
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate futures;
|
||||
extern crate futures_cpupool;
|
||||
|
@ -1,13 +1,55 @@
|
||||
use worker::Worker;
|
||||
|
||||
use super::{BlockingError, BlockingImpl};
|
||||
use futures::Poll;
|
||||
|
||||
use std::error::Error;
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use tokio_executor::Enter;
|
||||
|
||||
/// Error raised by `blocking`.
|
||||
pub struct BlockingError {
|
||||
_p: (),
|
||||
thread_local! {
|
||||
static CURRENT: Cell<BlockingImpl> = Cell::new(super::default_blocking);
|
||||
}
|
||||
|
||||
/// Ensures that the executor is removed from the thread-local context
|
||||
/// when leaving the scope. This handles cases that involve panicking.
|
||||
///
|
||||
/// **NOTE:** This is intended specifically for use by `tokio` 0.2's
|
||||
/// backwards-compatibility layer. In general, user code should not override the
|
||||
/// blocking implementation. If you use this, make sure you know what you're
|
||||
/// doing.
|
||||
pub struct DefaultGuard<'a> {
|
||||
prior: BlockingImpl,
|
||||
_lifetime: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
/// Set the default blocking implementation, returning a guard that resets the
|
||||
/// blocking implementation when dropped.
|
||||
///
|
||||
/// **NOTE:** This is intended specifically for use by `tokio` 0.2's
|
||||
/// backwards-compatibility layer. In general, user code should not override the
|
||||
/// blocking implementation. If you use this, make sure you know what you're
|
||||
/// doing.
|
||||
pub fn set_default<'a>(blocking: BlockingImpl) -> DefaultGuard<'a> {
|
||||
CURRENT.with(|cell| {
|
||||
let prior = cell.replace(blocking);
|
||||
DefaultGuard {
|
||||
prior,
|
||||
_lifetime: PhantomData,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Set the default blocking implementation for the duration of the closure.
|
||||
///
|
||||
/// **NOTE:** This is intended specifically for use by `tokio` 0.2's
|
||||
/// backwards-compatibility layer. In general, user code should not override the
|
||||
/// blocking implementation. If you use this, make sure you know what you're
|
||||
/// doing.
|
||||
pub fn with_default<F, R>(blocking: BlockingImpl, enter: &mut Enter, f: F) -> R
|
||||
where
|
||||
F: FnOnce(&mut Enter) -> R,
|
||||
{
|
||||
let _guard = set_default(blocking);
|
||||
f(enter)
|
||||
}
|
||||
|
||||
/// Enter a blocking section of code.
|
||||
@ -125,53 +167,52 @@ pub fn blocking<F, T>(f: F) -> Poll<T, BlockingError>
|
||||
where
|
||||
F: FnOnce() -> T,
|
||||
{
|
||||
let res = Worker::with_current(|worker| {
|
||||
let worker = match worker {
|
||||
Some(worker) => worker,
|
||||
None => {
|
||||
return Err(BlockingError { _p: () });
|
||||
}
|
||||
};
|
||||
CURRENT.with(|cell| {
|
||||
let blocking = cell.get();
|
||||
|
||||
// Transition the worker state to blocking. This will exit the fn early
|
||||
// with `NotReady` if the pool does not have enough capacity to enter
|
||||
// blocking mode.
|
||||
worker.transition_to_blocking()
|
||||
});
|
||||
// Object-safety workaround: the `Blocking` trait must be object-safe,
|
||||
// since we use a trait object in the thread-local. However, a blocking
|
||||
// _operation_ will be generic over the return type of the blocking
|
||||
// function. Therefore, rather than passing a function with a return
|
||||
// type to `Blocking::run_blocking`, we pass a _new_ closure which
|
||||
// doesn't have a return value. That closure invokes the blocking
|
||||
// function and assigns its value to `ret`, which we then unpack when
|
||||
// the blocking call finishes.
|
||||
let mut f = Some(f);
|
||||
let mut ret = None;
|
||||
{
|
||||
let ret2 = &mut ret;
|
||||
let mut run = move || {
|
||||
let f = f
|
||||
.take()
|
||||
.expect("blocking closure invoked twice; this is a bug!");
|
||||
*ret2 = Some((f)());
|
||||
};
|
||||
|
||||
// If the transition cannot happen, exit early
|
||||
try_ready!(res);
|
||||
try_ready!((blocking)(&mut run));
|
||||
}
|
||||
|
||||
// Currently in blocking mode, so call the inner closure
|
||||
let ret = f();
|
||||
|
||||
// Try to transition out of blocking mode. This is a fast path that takes
|
||||
// back ownership of the worker if the worker handoff didn't complete yet.
|
||||
Worker::with_current(|worker| {
|
||||
// Worker must be set since it was above.
|
||||
worker.unwrap().transition_from_blocking();
|
||||
});
|
||||
|
||||
// Return the result
|
||||
Ok(ret.into())
|
||||
// Return the result
|
||||
let ret =
|
||||
ret.expect("blocking function finished, but return value was unset; this is a bug!");
|
||||
Ok(ret.into())
|
||||
})
|
||||
}
|
||||
|
||||
impl fmt::Display for BlockingError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{}", self.description())
|
||||
}
|
||||
}
|
||||
// === impl DefaultGuard ===
|
||||
|
||||
impl fmt::Debug for BlockingError {
|
||||
impl<'a> fmt::Debug for DefaultGuard<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("BlockingError")
|
||||
.field("reason", &self.description())
|
||||
.finish()
|
||||
f.pad("DefaultGuard { .. }")
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for BlockingError {
|
||||
fn description(&self) -> &str {
|
||||
"`blocking` annotation used from outside the context of a thread pool"
|
||||
impl<'a> Drop for DefaultGuard<'a> {
|
||||
fn drop(&mut self) {
|
||||
// if the TLS value has already been torn down, there's nothing else we
|
||||
// can do. we're almost certainly panicking anyway.
|
||||
let _ = CURRENT.try_with(|cell| {
|
||||
cell.set(self.prior);
|
||||
});
|
||||
}
|
||||
}
|
88
third_party/rust/tokio-threadpool/src/blocking/mod.rs
vendored
Normal file
88
third_party/rust/tokio-threadpool/src/blocking/mod.rs
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
use worker::Worker;
|
||||
|
||||
use futures::{Async, Poll};
|
||||
use tokio_executor;
|
||||
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
mod global;
|
||||
pub use self::global::blocking;
|
||||
#[doc(hidden)]
|
||||
pub use self::global::{set_default, with_default, DefaultGuard};
|
||||
|
||||
/// Error raised by `blocking`.
|
||||
pub struct BlockingError {
|
||||
_p: (),
|
||||
}
|
||||
|
||||
/// A function implementing the behavior run on calls to `blocking`.
|
||||
///
|
||||
/// **NOTE:** This is intended specifically for use by `tokio` 0.2's
|
||||
/// backwards-compatibility layer. In general, user code should not override the
|
||||
/// blocking implementation. If you use this, make sure you know what you're
|
||||
/// doing.
|
||||
#[doc(hidden)]
|
||||
pub type BlockingImpl = fn(&mut dyn FnMut()) -> Poll<(), BlockingError>;
|
||||
|
||||
fn default_blocking(f: &mut dyn FnMut()) -> Poll<(), BlockingError> {
|
||||
let res = Worker::with_current(|worker| {
|
||||
let worker = match worker {
|
||||
Some(worker) => worker,
|
||||
None => {
|
||||
return Err(BlockingError::new());
|
||||
}
|
||||
};
|
||||
|
||||
// Transition the worker state to blocking. This will exit the fn early
|
||||
// with `NotReady` if the pool does not have enough capacity to enter
|
||||
// blocking mode.
|
||||
worker.transition_to_blocking()
|
||||
});
|
||||
|
||||
// If the transition cannot happen, exit early
|
||||
try_ready!(res);
|
||||
|
||||
// Currently in blocking mode, so call the inner closure.
|
||||
//
|
||||
// "Exit" the current executor in case the blocking function wants
|
||||
// to call a different executor.
|
||||
tokio_executor::exit(move || (f)());
|
||||
|
||||
// Try to transition out of blocking mode. This is a fast path that takes
|
||||
// back ownership of the worker if the worker handoff didn't complete yet.
|
||||
Worker::with_current(|worker| {
|
||||
// Worker must be set since it was above.
|
||||
worker.unwrap().transition_from_blocking();
|
||||
});
|
||||
|
||||
Ok(Async::Ready(()))
|
||||
}
|
||||
|
||||
impl BlockingError {
|
||||
/// Returns a new `BlockingError`.
|
||||
#[doc(hidden)]
|
||||
pub fn new() -> Self {
|
||||
Self { _p: () }
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for BlockingError {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{}", self.description())
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for BlockingError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("BlockingError")
|
||||
.field("reason", &self.description())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for BlockingError {
|
||||
fn description(&self) -> &str {
|
||||
"`blocking` annotation used from outside the context of a thread pool"
|
||||
}
|
||||
}
|
@ -67,7 +67,7 @@ pub struct Builder {
|
||||
max_blocking: usize,
|
||||
|
||||
/// Generates the `Park` instances
|
||||
new_park: Box<Fn(&WorkerId) -> BoxPark>,
|
||||
new_park: Box<dyn Fn(&WorkerId) -> BoxPark>,
|
||||
}
|
||||
|
||||
impl Builder {
|
||||
@ -223,7 +223,7 @@ impl Builder {
|
||||
/// ```
|
||||
pub fn panic_handler<F>(&mut self, f: F) -> &mut Self
|
||||
where
|
||||
F: Fn(Box<Any + Send>) + Send + Sync + 'static,
|
||||
F: Fn(Box<dyn Any + Send>) + Send + Sync + 'static,
|
||||
{
|
||||
self.config.panic_handler = Some(Arc::new(f));
|
||||
self
|
||||
|
@ -7,7 +7,7 @@ use tokio_executor::Enter;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct Callback {
|
||||
f: Arc<Fn(&Worker, &mut Enter) + Send + Sync>,
|
||||
f: Arc<dyn Fn(&Worker, &mut Enter) + Send + Sync>,
|
||||
}
|
||||
|
||||
impl Callback {
|
||||
|
@ -13,9 +13,9 @@ pub(crate) struct Config {
|
||||
pub name_prefix: Option<String>,
|
||||
pub stack_size: Option<usize>,
|
||||
pub around_worker: Option<Callback>,
|
||||
pub after_start: Option<Arc<Fn() + Send + Sync>>,
|
||||
pub before_stop: Option<Arc<Fn() + Send + Sync>>,
|
||||
pub panic_handler: Option<Arc<Fn(Box<Any + Send>) + Send + Sync>>,
|
||||
pub after_start: Option<Arc<dyn Fn() + Send + Sync>>,
|
||||
pub before_stop: Option<Arc<dyn Fn() + Send + Sync>>,
|
||||
pub panic_handler: Option<Arc<dyn Fn(Box<dyn Any + Send>) + Send + Sync>>,
|
||||
}
|
||||
|
||||
/// Max number of workers that can be part of a pool. This is the most that can
|
||||
|
13
third_party/rust/tokio-threadpool/src/lib.rs
vendored
13
third_party/rust/tokio-threadpool/src/lib.rs
vendored
@ -1,5 +1,5 @@
|
||||
#![doc(html_root_url = "https://docs.rs/tokio-threadpool/0.1.14")]
|
||||
#![deny(warnings, missing_docs, missing_debug_implementations)]
|
||||
#![doc(html_root_url = "https://docs.rs/tokio-threadpool/0.1.17")]
|
||||
#![deny(missing_docs, missing_debug_implementations)]
|
||||
|
||||
//! A work-stealing based thread pool for executing futures.
|
||||
//!
|
||||
@ -84,8 +84,9 @@ extern crate crossbeam_queue;
|
||||
extern crate crossbeam_utils;
|
||||
#[macro_use]
|
||||
extern crate futures;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate num_cpus;
|
||||
extern crate rand;
|
||||
extern crate slab;
|
||||
|
||||
#[macro_use]
|
||||
@ -141,13 +142,13 @@ extern crate log;
|
||||
//
|
||||
// [Treiber stack]: https://en.wikipedia.org/wiki/Treiber_Stack
|
||||
|
||||
pub mod park;
|
||||
|
||||
mod blocking;
|
||||
#[doc(hidden)]
|
||||
pub mod blocking;
|
||||
mod builder;
|
||||
mod callback;
|
||||
mod config;
|
||||
mod notifier;
|
||||
pub mod park;
|
||||
mod pool;
|
||||
mod sender;
|
||||
mod shutdown;
|
||||
|
@ -3,8 +3,8 @@ use tokio_executor::park::{Park, Unpark};
|
||||
use std::error::Error;
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) type BoxPark = Box<Park<Unpark = BoxUnpark, Error = ()> + Send>;
|
||||
pub(crate) type BoxUnpark = Box<Unpark>;
|
||||
pub(crate) type BoxPark = Box<dyn Park<Unpark = BoxUnpark, Error = ()> + Send>;
|
||||
pub(crate) type BoxUnpark = Box<dyn Unpark>;
|
||||
|
||||
pub(crate) struct BoxedPark<T>(T);
|
||||
|
||||
|
@ -17,6 +17,8 @@ use worker::{self, Worker, WorkerId};
|
||||
use futures::Poll;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::collections::hash_map::RandomState;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
use std::num::Wrapping;
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering::{AcqRel, Acquire};
|
||||
@ -25,7 +27,6 @@ use std::thread;
|
||||
|
||||
use crossbeam_deque::Injector;
|
||||
use crossbeam_utils::CachePadded;
|
||||
use rand;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Pool {
|
||||
@ -420,11 +421,7 @@ impl Pool {
|
||||
/// Uses a thread-local random number generator based on XorShift.
|
||||
pub fn rand_usize(&self) -> usize {
|
||||
thread_local! {
|
||||
static RNG: Cell<Wrapping<u32>> = {
|
||||
// The initial seed must be non-zero.
|
||||
let init = rand::random::<u32>() | 1;
|
||||
Cell::new(Wrapping(init))
|
||||
}
|
||||
static RNG: Cell<Wrapping<u32>> = Cell::new(Wrapping(prng_seed()));
|
||||
}
|
||||
|
||||
RNG.with(|rng| {
|
||||
@ -448,3 +445,31 @@ impl PartialEq for Pool {
|
||||
|
||||
unsafe impl Send for Pool {}
|
||||
unsafe impl Sync for Pool {}
|
||||
|
||||
// Return a thread-specific, 32-bit, non-zero seed value suitable for a 32-bit
|
||||
// PRNG. This uses one libstd RandomState for a default hasher and hashes on
|
||||
// the current thread ID to obtain an unpredictable, collision resistant seed.
|
||||
fn prng_seed() -> u32 {
|
||||
// This obtains a small number of random bytes from the host system (for
|
||||
// example, on unix via getrandom(2)) in order to seed an unpredictable and
|
||||
// HashDoS resistant 64-bit hash function (currently: `SipHasher13` with
|
||||
// 128-bit state). We only need one of these, to make the seeds for all
|
||||
// process threads different via hashed IDs, collision resistant, and
|
||||
// unpredictable.
|
||||
lazy_static! {
|
||||
static ref RND_STATE: RandomState = RandomState::new();
|
||||
}
|
||||
|
||||
// Hash the current thread ID to produce a u32 value
|
||||
let mut hasher = RND_STATE.build_hasher();
|
||||
thread::current().id().hash(&mut hasher);
|
||||
let hash: u64 = hasher.finish();
|
||||
let seed = (hash as u32) ^ ((hash >> 32) as u32);
|
||||
|
||||
// Ensure non-zero seed (Xorshift yields only zero's for that seed)
|
||||
if seed == 0 {
|
||||
0x9b4e_6d25 // misc bits, could be any non-zero
|
||||
} else {
|
||||
seed
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ impl tokio_executor::Executor for Sender {
|
||||
|
||||
fn spawn(
|
||||
&mut self,
|
||||
future: Box<Future<Item = (), Error = ()> + Send>,
|
||||
future: Box<dyn Future<Item = (), Error = ()> + Send>,
|
||||
) -> Result<(), SpawnError> {
|
||||
let mut s = &*self;
|
||||
tokio_executor::Executor::spawn(&mut s, future)
|
||||
@ -157,7 +157,7 @@ impl<'a> tokio_executor::Executor for &'a Sender {
|
||||
|
||||
fn spawn(
|
||||
&mut self,
|
||||
future: Box<Future<Item = (), Error = ()> + Send>,
|
||||
future: Box<dyn Future<Item = (), Error = ()> + Send>,
|
||||
) -> Result<(), SpawnError> {
|
||||
self.prepare_for_spawn()?;
|
||||
|
||||
|
@ -60,7 +60,7 @@ pub(crate) enum Run {
|
||||
Complete,
|
||||
}
|
||||
|
||||
type BoxFuture = Box<Future<Item = (), Error = ()> + Send + 'static>;
|
||||
type BoxFuture = Box<dyn Future<Item = (), Error = ()> + Send + 'static>;
|
||||
|
||||
// ===== impl Task =====
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
extern crate tokio_executor;
|
||||
extern crate tokio_threadpool;
|
||||
|
||||
extern crate env_logger;
|
||||
@ -44,6 +45,28 @@ fn basic() {
|
||||
rx2.recv().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn other_executors_can_run_inside_blocking() {
|
||||
let _ = ::env_logger::try_init();
|
||||
|
||||
let pool = Builder::new().pool_size(1).max_blocking(1).build();
|
||||
|
||||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
pool.spawn(lazy(move || {
|
||||
let res = blocking(|| {
|
||||
let _e = tokio_executor::enter().expect("nested blocking enter");
|
||||
tx.send(()).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert!(res.is_ready());
|
||||
Ok(().into())
|
||||
}));
|
||||
|
||||
rx.recv().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn notify_task_on_capacity() {
|
||||
const BLOCKING: usize = 10;
|
||||
|
@ -18,7 +18,9 @@ use std::time::Duration;
|
||||
|
||||
thread_local!(static FOO: Cell<u32> = Cell::new(0));
|
||||
|
||||
fn ignore_results<F: Future + Send + 'static>(f: F) -> Box<Future<Item = (), Error = ()> + Send> {
|
||||
fn ignore_results<F: Future + Send + 'static>(
|
||||
f: F,
|
||||
) -> Box<dyn Future<Item = (), Error = ()> + Send> {
|
||||
Box::new(f.map(|_| ()).map_err(|_| ()))
|
||||
}
|
||||
|
||||
|
2
third_party/rust/ws/.cargo-checksum.json
vendored
2
third_party/rust/ws/.cargo-checksum.json
vendored
@ -1 +1 @@
|
||||
{"files":{"CHANGELOG.md":"28a9bf7420eb71562ab146188cbc7cf9f299c90a3a46d92f32eb8ea48d70c77f","Cargo.toml":"1a95f4de257abd5db56dea0850a39d30d4c0d0762e3fb4429628b93070a10c96","LICENSE":"87bf8937aeabfcf53266f58d5c336e80b0be36f3005af4af6ee1bcd6e5a51b0e","README.md":"b68b23e68eb79683ba4de6797427a466812deaa7daa1c6bacbf9bce40bbf90b6","examples/autobahn-client.rs":"adca1e305f45277326c5cc11df1ae214258e6412b9aa0c9094144d0d6d95aaca","examples/autobahn-server.rs":"c7dd24bddbabd141746f57ca74d72cbdffd8a8d280e1bcf03f37ea663ab89ba0","examples/bench-server.rs":"1d9759223718a9677f308435a39de83841552fc0664e542c434a5af741f0b282","examples/bench.rs":"6b12d7edbe7dbf3917ab2f6a0c6867bb426dbf278bba98c65cdc458b0dbaa302","examples/channel.rs":"00ec08f63064688b61c807fad51edf25ed3a1afba0c7b5ebe4099bdaaa0438f8","examples/cli.rs":"e9fdb6b47dc67a9f896f56e152f85ead4497ef994c9f3617efac7bf8a974db44","examples/client.rs":"b9ca005dcdc637a1ae6efdd1b3c984c249be5fe718981d8073899357aff559eb","examples/external_shutdown.rs":"125ca6605f5540d30f347365fee8ee0e71bac2d3afc7a34ddc4ee03e453e5637","examples/html_chat.rs":"4347f092659bf402f29c5d874f85e2add96817d1e8a42c413b3e69dec5e98fdd","examples/peer2peer.rs":"6202a73534f38e8ddb1a8aad2507cbca39a2a75238e3243af30640a2dc38218a","examples/pong.rs":"64e7b1355759433327282209d2549bd0134a5d85c28bb6e691ebc04f2a8e9c5b","examples/remote_addr.rs":"59e0365093cfac1cb357c3a48caa6fe9d03d75cc7e61763b6b20ac9b011cdf78","examples/router.rs":"62b184b8e12315c7cb2064e490b491c75fe93de11fd315f42b79a0688d086580","examples/server.rs":"4bbc26ef67f7033692df7bfca1a80315ad6aaafe564a15deb9d6341421a1d7fd","examples/shared.rs":"5ad4866b2f187906d81b95c92afb2f2b8fe27c0703e37c865f026bcdbd9dcb9f","examples/ssl-server.rs":"58746d094393bc1ee14011abd41a438c86137ffdbf0c45a08f7415d10881c751","examples/threaded.rs":"c55cd396b23ece7270c7a779e1c39eafe50c9860dac805c5a2c67bda1d83d395","examples/unsafe-ssl-client.rs":"d703abe42ae2ba28a3e419ac6efba0f8b02cc0c61a8772688100cacfaa522a8d","src/communication.rs":"bb86c10ca0cdecef6eb5aa94b9c78857ca011036e3e78b70d9fb747e11439446","src/connection.rs":"2e9fcdb5b3577de0380bea41658c44a314b0e43146fe55d25533a891435924c4","src/deflate/context.rs":"dc9e678c143db4c8c78214fb9fdb7b3d9544fc8fbb48ce285b7e7aa3d00fce9b","src/deflate/extension.rs":"131a9525b8234f686e59bb7ac848d1daf2b30d1a8a9729a82b84b678936f82bb","src/deflate/mod.rs":"fc927311d2d1ecee787bda54524681ead33b3d62154a90fab458fca4d00ccc04","src/factory.rs":"bff726225c632e2ee94984820cc7aa647c234ab69b75c5cb9cfff8d97eceadb6","src/frame.rs":"c97015c2be9ccfb3f5dbfbe6eeebee526a9bc9cbd7f65e8f5d9423ff6d96b284","src/handler.rs":"e69a8d8d64987c4ed6d2429db8c5408688f1fe4dbe1369dee290bbcc13eb5c42","src/handshake.rs":"33b64ad48fa11ebd14f02c5e386cc9c50c9149405aaab53918a0ccdaff65e4c4","src/io.rs":"0b8389e0b42cb4edbea2529bf983262db3c7bf8fc0a02d214689ecc00feba3e7","src/lib.rs":"96437b3777df6453e81989c62fcff343751ef247ac213b50f496e8832ad286c8","src/message.rs":"b08cd9b7426b8fb2c13bfed45ba81e59fc262988c2a46cdbe77c5161fc08d9b0","src/protocol.rs":"5096c4a96ac0c4296909bdc0d30a808da6dee44ff5550ac345f4ef4020cbe173","src/result.rs":"120d47ebb442f9a07c3e854c61fc3ec73683d6d44fa5554cbb59cfc44f008a4b","src/stream.rs":"e648eaeec372adb1fa3e441695248af44456d781c3ef50845b4b40d185f72a37","src/util.rs":"428a5d4465aebf29e1af940a06b0f82e758e7aa9953169b9d5c61858f57ded7b","tests/bind.rs":"ceea3d8da1f216e5c919220a8f3b360d8e752c7c32f045d4bcf638b0f86ae434","tests/deflate.rs":"dcf9f5139d1a5d63cf1c75f450781933d6e0730dc710ac8a01ad6ff2ec2774a0","tests/fuzzingclient.json":"524dfc4da9385ccab2ecac941114ca2bd6be3bd553d06f637ad26d3243407261","tests/fuzzingserver.json":"0574cb0b8deb9a99b70e4d300f4877905b69d59a093a6937e4cbdac4cd2123af","tests/shutdown.rs":"7338f9feec52c405ab17c1f00a8ce4494c89f50043bd7423b470dd2a26f97b3b"},"package":"8a6f5bb86663ff4d1639408410f50bf6050367a8525d644d49a6894cd618a631"}
|
||||
{"files":{"CHANGELOG.md":"28a9bf7420eb71562ab146188cbc7cf9f299c90a3a46d92f32eb8ea48d70c77f","Cargo.lock":"c5261b6ab83a4ed7b8f0701048778b39585a0ad979aeed63d9d079e9c56d5c3b","Cargo.toml":"b3883e5cbe16ea8cebf5e553f1f8607b17f67c848c3a2734548b56d4e652929c","LICENSE":"87bf8937aeabfcf53266f58d5c336e80b0be36f3005af4af6ee1bcd6e5a51b0e","README.md":"b68b23e68eb79683ba4de6797427a466812deaa7daa1c6bacbf9bce40bbf90b6","examples/autobahn-client.rs":"adca1e305f45277326c5cc11df1ae214258e6412b9aa0c9094144d0d6d95aaca","examples/autobahn-server.rs":"c7dd24bddbabd141746f57ca74d72cbdffd8a8d280e1bcf03f37ea663ab89ba0","examples/bench-server.rs":"1d9759223718a9677f308435a39de83841552fc0664e542c434a5af741f0b282","examples/bench.rs":"6b12d7edbe7dbf3917ab2f6a0c6867bb426dbf278bba98c65cdc458b0dbaa302","examples/channel.rs":"00ec08f63064688b61c807fad51edf25ed3a1afba0c7b5ebe4099bdaaa0438f8","examples/cli.rs":"e9fdb6b47dc67a9f896f56e152f85ead4497ef994c9f3617efac7bf8a974db44","examples/client.rs":"b9ca005dcdc637a1ae6efdd1b3c984c249be5fe718981d8073899357aff559eb","examples/external_shutdown.rs":"125ca6605f5540d30f347365fee8ee0e71bac2d3afc7a34ddc4ee03e453e5637","examples/html_chat.rs":"4347f092659bf402f29c5d874f85e2add96817d1e8a42c413b3e69dec5e98fdd","examples/peer2peer.rs":"6202a73534f38e8ddb1a8aad2507cbca39a2a75238e3243af30640a2dc38218a","examples/pong.rs":"64e7b1355759433327282209d2549bd0134a5d85c28bb6e691ebc04f2a8e9c5b","examples/remote_addr.rs":"59e0365093cfac1cb357c3a48caa6fe9d03d75cc7e61763b6b20ac9b011cdf78","examples/router.rs":"62b184b8e12315c7cb2064e490b491c75fe93de11fd315f42b79a0688d086580","examples/server.rs":"4bbc26ef67f7033692df7bfca1a80315ad6aaafe564a15deb9d6341421a1d7fd","examples/shared.rs":"5ad4866b2f187906d81b95c92afb2f2b8fe27c0703e37c865f026bcdbd9dcb9f","examples/ssl-server.rs":"58746d094393bc1ee14011abd41a438c86137ffdbf0c45a08f7415d10881c751","examples/threaded.rs":"c55cd396b23ece7270c7a779e1c39eafe50c9860dac805c5a2c67bda1d83d395","examples/unsafe-ssl-client.rs":"d703abe42ae2ba28a3e419ac6efba0f8b02cc0c61a8772688100cacfaa522a8d","src/communication.rs":"bb86c10ca0cdecef6eb5aa94b9c78857ca011036e3e78b70d9fb747e11439446","src/connection.rs":"2e9fcdb5b3577de0380bea41658c44a314b0e43146fe55d25533a891435924c4","src/deflate/context.rs":"dc9e678c143db4c8c78214fb9fdb7b3d9544fc8fbb48ce285b7e7aa3d00fce9b","src/deflate/extension.rs":"131a9525b8234f686e59bb7ac848d1daf2b30d1a8a9729a82b84b678936f82bb","src/deflate/mod.rs":"fc927311d2d1ecee787bda54524681ead33b3d62154a90fab458fca4d00ccc04","src/factory.rs":"bff726225c632e2ee94984820cc7aa647c234ab69b75c5cb9cfff8d97eceadb6","src/frame.rs":"c97015c2be9ccfb3f5dbfbe6eeebee526a9bc9cbd7f65e8f5d9423ff6d96b284","src/handler.rs":"e69a8d8d64987c4ed6d2429db8c5408688f1fe4dbe1369dee290bbcc13eb5c42","src/handshake.rs":"33b64ad48fa11ebd14f02c5e386cc9c50c9149405aaab53918a0ccdaff65e4c4","src/io.rs":"0b8389e0b42cb4edbea2529bf983262db3c7bf8fc0a02d214689ecc00feba3e7","src/lib.rs":"96437b3777df6453e81989c62fcff343751ef247ac213b50f496e8832ad286c8","src/message.rs":"b08cd9b7426b8fb2c13bfed45ba81e59fc262988c2a46cdbe77c5161fc08d9b0","src/protocol.rs":"5096c4a96ac0c4296909bdc0d30a808da6dee44ff5550ac345f4ef4020cbe173","src/result.rs":"102deb3d3f173f2d73a460217afb85253ee5efd9289a83b6d3fd1d5754f45bce","src/stream.rs":"e648eaeec372adb1fa3e441695248af44456d781c3ef50845b4b40d185f72a37","src/util.rs":"428a5d4465aebf29e1af940a06b0f82e758e7aa9953169b9d5c61858f57ded7b","tests/bind.rs":"ceea3d8da1f216e5c919220a8f3b360d8e752c7c32f045d4bcf638b0f86ae434","tests/deflate.rs":"dcf9f5139d1a5d63cf1c75f450781933d6e0730dc710ac8a01ad6ff2ec2774a0","tests/fuzzingclient.json":"524dfc4da9385ccab2ecac941114ca2bd6be3bd553d06f637ad26d3243407261","tests/fuzzingserver.json":"0574cb0b8deb9a99b70e4d300f4877905b69d59a093a6937e4cbdac4cd2123af","tests/shutdown.rs":"7338f9feec52c405ab17c1f00a8ce4494c89f50043bd7423b470dd2a26f97b3b"},"package":"c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94"}
|
1033
third_party/rust/ws/Cargo.lock
generated
vendored
Normal file
1033
third_party/rust/ws/Cargo.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
third_party/rust/ws/Cargo.toml
vendored
4
third_party/rust/ws/Cargo.toml
vendored
@ -12,7 +12,7 @@
|
||||
|
||||
[package]
|
||||
name = "ws"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
authors = ["Jason Housley <HousleyJK@gmail.com>"]
|
||||
description = "Lightweight, event-driven WebSockets for Rust."
|
||||
documentation = "https://ws-rs.org/docs"
|
||||
@ -55,7 +55,7 @@ version = "0.10"
|
||||
optional = true
|
||||
|
||||
[dependencies.rand]
|
||||
version = "0.6"
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.sha-1]
|
||||
version = "0.8.0"
|
||||
|
6
third_party/rust/ws/src/result.rs
vendored
6
third_party/rust/ws/src/result.rs
vendored
@ -61,7 +61,7 @@ pub enum Kind {
|
||||
/// A custom error kind for use by applications. This error kind involves extra overhead
|
||||
/// because it will allocate the memory on the heap. The WebSocket ignores such errors by
|
||||
/// default, simply passing them to the Connection Handler.
|
||||
Custom(Box<StdError + Send + Sync>),
|
||||
Custom(Box<dyn StdError + Send + Sync>),
|
||||
}
|
||||
|
||||
/// A struct indicating the kind of error that has occurred and any precise details of that error.
|
||||
@ -81,7 +81,7 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_box(self) -> Box<StdError> {
|
||||
pub fn into_box(self) -> Box<dyn StdError> {
|
||||
match self.kind {
|
||||
Kind::Custom(err) => err,
|
||||
_ => Box::new(self),
|
||||
@ -127,7 +127,7 @@ impl StdError for Error {
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&StdError> {
|
||||
fn cause(&self) -> Option<&dyn StdError> {
|
||||
match self.kind {
|
||||
Kind::Encoding(ref err) => Some(err),
|
||||
Kind::Io(ref err) => Some(err),
|
||||
|
@ -21,6 +21,6 @@ version = "0.1.3"
|
||||
[dev-dependencies]
|
||||
#ctrlc = "3.1.1"
|
||||
lazy_static = "1.0.1"
|
||||
rand = "0.6"
|
||||
rand = "0.7"
|
||||
regex = "1"
|
||||
tempfile = "3"
|
||||
|
Loading…
Reference in New Issue
Block a user