Add search iterator

This commit is contained in:
Glenn Griffin 2020-02-07 09:55:10 -08:00
parent 7b68317ef1
commit 7a6394c7f8
2 changed files with 464 additions and 252 deletions

599
Cargo.lock generated
View File

@ -1,11 +1,5 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]]
name = "adler32"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.8" version = "0.7.8"
@ -53,28 +47,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
[[package]]
name = "backtrace"
version = "0.3.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f80256bc78f67e7df7e36d77366f636ed976895d91fe2ab9efa3973e8fe8c4f"
dependencies = [
"backtrace-sys",
"cfg-if",
"libc",
"rustc-demangle",
]
[[package]]
name = "backtrace-sys"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.10.1" version = "0.10.1"
@ -84,6 +56,12 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "base64"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.2.1"
@ -113,6 +91,12 @@ dependencies = [
"iovec", "iovec",
] ]
[[package]]
name = "bytes"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.50" version = "1.0.50"
@ -162,41 +146,20 @@ dependencies = [
] ]
[[package]] [[package]]
name = "cookie" name = "core-foundation"
version = "0.12.0" version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
dependencies = [ dependencies = [
"time", "core-foundation-sys",
"url 1.7.2", "libc",
] ]
[[package]] [[package]]
name = "cookie_store" name = "core-foundation-sys"
version = "0.7.0" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46750b3f362965f197996c4448e4a0935e791bf7d6631bfce9ee0af3d24c919c" checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
dependencies = [
"cookie",
"failure",
"idna 0.1.5",
"log 0.4.8",
"publicsuffix",
"serde",
"serde_json",
"time",
"try_from",
"url 1.7.2",
]
[[package]]
name = "crc32fast"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "crossbeam-deque" name = "crossbeam-deque"
@ -282,49 +245,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "error-chain"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9"
dependencies = [
"version_check 0.1.5",
]
[[package]]
name = "failure"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
dependencies = [
"backtrace",
"failure_derive",
]
[[package]]
name = "failure_derive"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]
[[package]]
name = "flate2"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
dependencies = [
"cfg-if",
"crc32fast",
"libc",
"miniz_oxide",
]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.6" version = "1.0.6"
@ -359,6 +279,21 @@ version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
[[package]]
name = "futures-channel"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a"
[[package]] [[package]]
name = "futures-cpupool" name = "futures-cpupool"
version = "0.1.8" version = "0.1.8"
@ -369,6 +304,53 @@ dependencies = [
"num_cpus", "num_cpus",
] ]
[[package]]
name = "futures-io"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6"
[[package]]
name = "futures-macro"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7"
dependencies = [
"proc-macro-hack",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6"
[[package]]
name = "futures-task"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27"
[[package]]
name = "futures-util"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5"
dependencies = [
"futures-core",
"futures-io",
"futures-macro",
"futures-task",
"memchr",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab",
]
[[package]] [[package]]
name = "google-photoslibrary1" name = "google-photoslibrary1"
version = "0.1.0-20200203" version = "0.1.0-20200203"
@ -389,7 +371,7 @@ name = "google_api_auth"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/google-apis-rs/generator#7504e310e8c4c361aca998ea14c309d5c46967cc" source = "git+https://github.com/google-apis-rs/generator#7504e310e8c4c361aca998ea14c309d5c46967cc"
dependencies = [ dependencies = [
"tokio", "tokio 0.1.22",
"yup-oauth2", "yup-oauth2",
] ]
@ -419,10 +401,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"bytes", "bytes 0.4.12",
"fnv", "fnv",
"futures", "futures",
"http", "http 0.1.21",
"indexmap", "indexmap",
"log 0.4.8", "log 0.4.8",
"slab", "slab",
@ -430,6 +412,25 @@ dependencies = [
"tokio-io", "tokio-io",
] ]
[[package]]
name = "h2"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1"
dependencies = [
"bytes 0.5.4",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http 0.2.0",
"indexmap",
"log 0.4.8",
"slab",
"tokio 0.2.11",
"tokio-util",
]
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.1" version = "0.3.1"
@ -454,7 +455,18 @@ version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"fnv",
"itoa",
]
[[package]]
name = "http"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b"
dependencies = [
"bytes 0.5.4",
"fnv", "fnv",
"itoa", "itoa",
] ]
@ -465,12 +477,22 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"http", "http 0.1.21",
"tokio-buf", "tokio-buf",
] ]
[[package]]
name = "http-body"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
dependencies = [
"bytes 0.5.4",
"http 0.2.0",
]
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.3.4" version = "1.3.4"
@ -483,12 +505,12 @@ version = "0.12.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"futures-cpupool", "futures-cpupool",
"h2", "h2 0.1.26",
"http", "http 0.1.21",
"http-body", "http-body 0.1.0",
"httparse", "httparse",
"iovec", "iovec",
"itoa", "itoa",
@ -496,7 +518,7 @@ dependencies = [
"net2", "net2",
"rustc_version", "rustc_version",
"time", "time",
"tokio", "tokio 0.1.22",
"tokio-buf", "tokio-buf",
"tokio-executor", "tokio-executor",
"tokio-io", "tokio-io",
@ -504,7 +526,31 @@ dependencies = [
"tokio-tcp", "tokio-tcp",
"tokio-threadpool", "tokio-threadpool",
"tokio-timer", "tokio-timer",
"want", "want 0.2.0",
]
[[package]]
name = "hyper"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa1c527bbc634be72aa7ba31e4e4def9bbb020f5416916279b7c705cd838893e"
dependencies = [
"bytes 0.5.4",
"futures-channel",
"futures-core",
"futures-util",
"h2 0.2.1",
"http 0.2.0",
"http-body 0.3.1",
"httparse",
"itoa",
"log 0.4.8",
"net2",
"pin-project",
"time",
"tokio 0.2.11",
"tower-service",
"want 0.3.0",
] ]
[[package]] [[package]]
@ -513,17 +559,34 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719d85c7df4a7f309a77d145340a063ea929dcb2e025bae46a80345cffec2952" checksum = "719d85c7df4a7f309a77d145340a063ea929dcb2e025bae46a80345cffec2952"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"ct-logs", "ct-logs",
"futures", "futures",
"hyper", "hyper 0.12.35",
"rustls", "rustls",
"tokio-io", "tokio-io",
"tokio-rustls", "tokio-rustls 0.10.3",
"webpki", "webpki",
"webpki-roots", "webpki-roots",
] ]
[[package]]
name = "hyper-rustls"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ea6215c7314d450ee45970ab8b3851ab447a0e6bafdd19e31b20a42dbb7faf"
dependencies = [
"bytes 0.5.4",
"ct-logs",
"futures-util",
"hyper 0.13.2",
"rustls",
"rustls-native-certs",
"tokio 0.2.11",
"tokio-rustls 0.12.2",
"webpki",
]
[[package]] [[package]]
name = "idna" name = "idna"
version = "0.1.5" version = "0.1.5"
@ -686,15 +749,6 @@ dependencies = [
"unicase", "unicase",
] ]
[[package]]
name = "miniz_oxide"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5"
dependencies = [
"adler32",
]
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.6.21" version = "0.6.21"
@ -793,6 +847,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
[[package]]
name = "openssl-probe"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.9.0" version = "0.9.0"
@ -845,6 +905,38 @@ dependencies = [
"yup-oauth2", "yup-oauth2",
] ]
[[package]]
name = "pin-project"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae"
[[package]]
name = "pin-utils"
version = "0.1.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "0.4.8" version = "0.4.8"
@ -871,6 +963,23 @@ dependencies = [
"syn-mid", "syn-mid",
] ]
[[package]]
name = "proc-macro-hack"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "proc-macro-nested"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.8" version = "1.0.8"
@ -880,19 +989,6 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "publicsuffix"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bbaa49075179162b49acac1c6aa45fb4dafb5f13cf6794276d77bc7fd95757b"
dependencies = [
"error-chain",
"idna 0.2.0",
"lazy_static 1.4.0",
"regex",
"url 2.1.1",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.2" version = "1.0.2"
@ -1052,36 +1148,37 @@ checksum = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.9.24" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f88643aea3c1343c804950d7bf983bd2067f5ab59db6d613a08e05572f2714ab" checksum = "c0e798e19e258bf6c30a304622e3e9ac820e483b06a1857a026e1f109b113fe4"
dependencies = [ dependencies = [
"base64", "base64 0.11.0",
"bytes", "bytes 0.5.4",
"cookie",
"cookie_store",
"encoding_rs", "encoding_rs",
"flate2", "futures-core",
"futures", "futures-util",
"http", "http 0.2.0",
"hyper", "http-body 0.3.1",
"hyper-rustls", "hyper 0.13.2",
"hyper-rustls 0.19.1",
"js-sys",
"lazy_static 1.4.0",
"log 0.4.8", "log 0.4.8",
"mime", "mime",
"mime_guess", "mime_guess",
"percent-encoding 2.1.0",
"pin-project-lite",
"rustls", "rustls",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"time", "time",
"tokio", "tokio 0.2.11",
"tokio-executor", "tokio-rustls 0.12.2",
"tokio-io", "url 2.1.1",
"tokio-rustls", "wasm-bindgen",
"tokio-threadpool", "wasm-bindgen-futures",
"tokio-timer", "web-sys",
"url 1.7.2",
"uuid",
"webpki-roots", "webpki-roots",
"winreg", "winreg",
] ]
@ -1101,12 +1198,6 @@ dependencies = [
"winapi 0.3.8", "winapi 0.3.8",
] ]
[[package]]
name = "rustc-demangle"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.2.3" version = "0.2.3"
@ -1122,13 +1213,25 @@ version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e"
dependencies = [ dependencies = [
"base64", "base64 0.10.1",
"log 0.4.8", "log 0.4.8",
"ring", "ring",
"sct", "sct",
"webpki", "webpki",
] ]
[[package]]
name = "rustls-native-certs"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51ffebdbb48c14f84eba0b715197d673aff1dd22cc1007ca647e28483bbcc307"
dependencies = [
"openssl-probe",
"rustls",
"schannel",
"security-framework",
]
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.2" version = "1.0.2"
@ -1146,6 +1249,16 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" checksum = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
[[package]]
name = "schannel"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "507a9e6e8ffe0a4e0ebb9a10293e62fdf7657c06f1b8bb07a8fcf697d2abf295"
dependencies = [
"lazy_static 1.4.0",
"winapi 0.3.8",
]
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.0.0" version = "1.0.0"
@ -1162,6 +1275,27 @@ dependencies = [
"untrusted", "untrusted",
] ]
[[package]]
name = "security-framework"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df"
dependencies = [
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895"
dependencies = [
"core-foundation-sys",
]
[[package]] [[package]]
name = "semver" name = "semver"
version = "0.9.0" version = "0.9.0"
@ -1221,14 +1355,14 @@ dependencies = [
[[package]] [[package]]
name = "serde_urlencoded" name = "serde_urlencoded"
version = "0.5.5" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97"
dependencies = [ dependencies = [
"dtoa", "dtoa",
"itoa", "itoa",
"serde", "serde",
"url 1.7.2", "url 2.1.1",
] ]
[[package]] [[package]]
@ -1283,7 +1417,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
] ]
[[package]] [[package]]
@ -1338,18 +1472,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "synstructure"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
dependencies = [
"proc-macro2",
"quote",
"syn",
"unicode-xid",
]
[[package]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.1.0" version = "1.1.0"
@ -1377,7 +1499,7 @@ version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dafb35214e317d6c0a72b16d1aa667bbc0fea57e302798e7bc520e0f39988006" checksum = "dafb35214e317d6c0a72b16d1aa667bbc0fea57e302798e7bc520e0f39988006"
dependencies = [ dependencies = [
"base64", "base64 0.10.1",
"byteorder", "byteorder",
"chrono", "chrono",
"rand", "rand",
@ -1430,7 +1552,7 @@ version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"mio", "mio",
"num_cpus", "num_cpus",
@ -1448,13 +1570,30 @@ dependencies = [
"tokio-uds", "tokio-uds",
] ]
[[package]]
name = "tokio"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b"
dependencies = [
"bytes 0.5.4",
"fnv",
"iovec",
"lazy_static 1.4.0",
"memchr",
"mio",
"num_cpus",
"pin-project-lite",
"slab",
]
[[package]] [[package]]
name = "tokio-buf" name = "tokio-buf"
version = "0.1.1" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"either", "either",
"futures", "futures",
] ]
@ -1465,7 +1604,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" checksum = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"tokio-io", "tokio-io",
] ]
@ -1507,7 +1646,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" checksum = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"log 0.4.8", "log 0.4.8",
] ]
@ -1537,7 +1676,7 @@ version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d7cf08f990090abd6c6a73cab46fed62f85e8aef8b99e4b918a9f4a637f0676" checksum = "2d7cf08f990090abd6c6a73cab46fed62f85e8aef8b99e4b918a9f4a637f0676"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"iovec", "iovec",
"rustls", "rustls",
@ -1545,6 +1684,18 @@ dependencies = [
"webpki", "webpki",
] ]
[[package]]
name = "tokio-rustls"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "141afec0978abae6573065a48882c6bae44c5cc61db9b511ac4abf6a09bfd9cc"
dependencies = [
"futures-core",
"rustls",
"tokio 0.2.11",
"webpki",
]
[[package]] [[package]]
name = "tokio-sync" name = "tokio-sync"
version = "0.1.7" version = "0.1.7"
@ -1561,7 +1712,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" checksum = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"iovec", "iovec",
"mio", "mio",
@ -1604,7 +1755,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b" checksum = "f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"log 0.4.8", "log 0.4.8",
"mio", "mio",
@ -1619,7 +1770,7 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" checksum = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445"
dependencies = [ dependencies = [
"bytes", "bytes 0.4.12",
"futures", "futures",
"iovec", "iovec",
"libc", "libc",
@ -1631,21 +1782,32 @@ dependencies = [
"tokio-reactor", "tokio-reactor",
] ]
[[package]]
name = "tokio-util"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930"
dependencies = [
"bytes 0.5.4",
"futures-core",
"futures-sink",
"log 0.4.8",
"pin-project-lite",
"tokio 0.2.11",
]
[[package]]
name = "tower-service"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
[[package]] [[package]]
name = "try-lock" name = "try-lock"
version = "0.2.2" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
[[package]]
name = "try_from"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "unicase" name = "unicase"
version = "2.6.0" version = "2.6.0"
@ -1728,15 +1890,6 @@ dependencies = [
"percent-encoding 2.1.0", "percent-encoding 2.1.0",
] ]
[[package]]
name = "uuid"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
dependencies = [
"rand",
]
[[package]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.1" version = "0.8.1"
@ -1772,6 +1925,16 @@ dependencies = [
"try-lock", "try-lock",
] ]
[[package]]
name = "want"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
dependencies = [
"log 0.4.8",
"try-lock",
]
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.58" version = "0.2.58"
@ -1779,6 +1942,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5205e9afdf42282b192e2310a5b463a6d1c1d774e30dc3c791ac37ab42d2616c" checksum = "5205e9afdf42282b192e2310a5b463a6d1c1d774e30dc3c791ac37ab42d2616c"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"serde",
"serde_json",
"wasm-bindgen-macro", "wasm-bindgen-macro",
] ]
@ -1797,6 +1962,18 @@ dependencies = [
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bbdd49e3e28b40dec6a9ba8d17798245ce32b019513a845369c641b275135d9"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.58" version = "0.2.58"
@ -1951,19 +2128,19 @@ version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "687c1c52bf66691f1e7426e7520aecec25bf659835179095280a4acfcb24f63f" checksum = "687c1c52bf66691f1e7426e7520aecec25bf659835179095280a4acfcb24f63f"
dependencies = [ dependencies = [
"base64", "base64 0.10.1",
"chrono", "chrono",
"futures", "futures",
"http", "http 0.1.21",
"hyper", "hyper 0.12.35",
"hyper-rustls", "hyper-rustls 0.17.1",
"itertools", "itertools",
"log 0.3.9", "log 0.3.9",
"rustls", "rustls",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"tokio", "tokio 0.1.22",
"tokio-threadpool", "tokio-threadpool",
"tokio-timer", "tokio-timer",
"url 1.7.2", "url 1.7.2",

View File

@ -3,11 +3,9 @@ use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
use google_api_auth; use google_api_auth;
use google_photoslibrary1; use google_photoslibrary1 as photos;
use google_photoslibrary1::schemas::Album; use log::{debug, info};
use google_photoslibrary1::schemas::SearchMediaItemsRequest; use photos::schemas::{Album, MediaItem, SearchMediaItemsRequest};
use log::debug;
use log::info;
use regex::Regex; use regex::Regex;
use structopt::StructOpt; use structopt::StructOpt;
use yup_oauth2::{Authenticator, InstalledFlow}; use yup_oauth2::{Authenticator, InstalledFlow};
@ -54,7 +52,7 @@ struct Opt {
fn new_client( fn new_client(
credentials: &PathBuf, credentials: &PathBuf,
token_cache: &PathBuf, token_cache: &PathBuf,
) -> Result<google_photoslibrary1::Client, Box<dyn Error>> { ) -> Result<photos::Client, Box<dyn Error>> {
let secret = yup_oauth2::read_application_secret(credentials)?; let secret = yup_oauth2::read_application_secret(credentials)?;
// Create an authenticator that uses an InstalledFlow to authenticate. The // Create an authenticator that uses an InstalledFlow to authenticate. The
@ -69,51 +67,88 @@ fn new_client(
.build() .build()
.unwrap(); .unwrap();
let scopes = vec![google_photoslibrary1::scopes::PHOTOSLIBRARY_READONLY]; let scopes = vec![photos::scopes::PHOTOSLIBRARY_READONLY];
let auth = google_api_auth::yup_oauth2::from_authenticator(auth, scopes); let auth = google_api_auth::yup_oauth2::from_authenticator(auth, scopes);
Ok(google_photoslibrary1::Client::new(auth)) Ok(photos::Client::new(auth))
} }
fn search_media_items( struct SearchIter<'a> {
client: google_photoslibrary1::Client, client: &'a photos::Client,
album_id: String, items: ::std::vec::IntoIter<MediaItem>,
) -> Result<(), Box<dyn Error>> { finished: bool,
let mut page_token = None; req: SearchMediaItemsRequest,
let mut total = 0; }
impl<'a> SearchIter<'a> {
fn new(client: &'a photos::Client, req: SearchMediaItemsRequest) -> Self {
SearchIter {
client,
items: Vec::new().into_iter(),
finished: false,
req,
}
}
}
impl<'a> Iterator for SearchIter<'a> {
type Item = Result<MediaItem, photos::Error>;
fn next(&mut self) -> Option<Result<MediaItem, photos::Error>> {
loop { loop {
let resp = client if let Some(v) = self.items.next() {
return Some(Ok(v));
}
if self.finished {
return None;
}
let resp = match self
.client
.media_items() .media_items()
.search(SearchMediaItemsRequest { .search(self.req.clone())
.execute_with_default_fields()
{
Ok(resp) => resp,
Err(err) => return Some(Err(err)),
};
if resp.next_page_token.is_none() {
self.finished = true;
}
self.req.page_token = resp.next_page_token;
if let Some(items) = resp.media_items {
self.items = items.into_iter();
}
}
}
}
fn search_media_items(client: photos::Client, album_id: String) -> Result<(), Box<dyn Error>> {
let mut total = 0;
let media_items = SearchIter::new(
&client,
SearchMediaItemsRequest {
album_id: Some(album_id.clone()), album_id: Some(album_id.clone()),
// 100 is the documented max. // 100 is the documented max.
page_size: Some(100), page_size: Some(100),
page_token,
..Default::default() ..Default::default()
}) },
.execute_with_all_fields()?; );
let media_items = resp.media_items.ok_or("no results")?;
println!("got ({}) items", media_items.len());
total += media_items.len();
for mi in media_items { for mi in media_items {
let mi = mi?;
total += 1;
println!( println!(
"{} {}", "{} {}",
mi.id.unwrap_or("NO ID".to_string()), mi.id.unwrap_or("NO ID".to_string()),
mi.filename.unwrap_or("NO FILENAME".to_string()) mi.filename.unwrap_or("NO FILENAME".to_string())
); );
} }
page_token = resp.next_page_token;
if page_token.is_none() {
println!("({}) items total", total); println!("({}) items total", total);
return Ok(()); Ok(())
}
}
} }
fn sync_albums( fn sync_albums(
client: google_photoslibrary1::Client, client: photos::Client,
title_filter: Option<Regex>, title_filter: Option<Regex>,
output_dir: PathBuf, output_dir: PathBuf,
) -> Result<(), Box<dyn Error>> { ) -> Result<(), Box<dyn Error>> {
@ -146,7 +181,7 @@ fn print_albums(albums: Vec<Album>) {
} }
fn list_albums( fn list_albums(
client: google_photoslibrary1::Client, client: photos::Client,
title_filter: Option<Regex>, title_filter: Option<Regex>,
) -> Result<Vec<Album>, Box<dyn Error>> { ) -> Result<Vec<Album>, Box<dyn Error>> {
Ok(client Ok(client