mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-22 10:26:30 +00:00
remove failure
This commit is contained in:
parent
9a1bee0eba
commit
820a3cfd28
17 changed files with 39 additions and 138 deletions
109
Cargo.lock
generated
109
Cargo.lock
generated
|
@ -6,47 +6,24 @@ 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 = "2692800d602527d2b8fea50036119c37df74ab565b10e285706a3dcec0ec3e16"
|
checksum = "2692800d602527d2b8fea50036119c37df74ab565b10e285706a3dcec0ec3e16"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "addr2line"
|
|
||||||
version = "0.13.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
|
|
||||||
dependencies = [
|
|
||||||
"gimli",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "adler"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "antidote"
|
name = "antidote"
|
||||||
version = "1.0.0"
|
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 = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5"
|
checksum = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anyhow"
|
||||||
|
version = "1.0.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "backtrace"
|
|
||||||
version = "0.3.50"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293"
|
|
||||||
dependencies = [
|
|
||||||
"addr2line",
|
|
||||||
"cfg-if",
|
|
||||||
"libc",
|
|
||||||
"miniz_oxide",
|
|
||||||
"object",
|
|
||||||
"rustc-demangle",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "badge"
|
name = "badge"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -269,28 +246,6 @@ version = "0.4.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
|
checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "failure"
|
|
||||||
version = "0.1.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
|
|
||||||
dependencies = [
|
|
||||||
"backtrace",
|
|
||||||
"failure_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "failure_derive"
|
|
||||||
version = "0.1.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"synstructure",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fake-simd"
|
name = "fake-simd"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
|
@ -365,12 +320,6 @@ dependencies = [
|
||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gimli"
|
|
||||||
version = "0.22.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.9.1"
|
version = "0.9.1"
|
||||||
|
@ -652,16 +601,6 @@ version = "0.3.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "miniz_oxide"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9"
|
|
||||||
dependencies = [
|
|
||||||
"adler",
|
|
||||||
"autocfg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.6.22"
|
version = "0.6.22"
|
||||||
|
@ -768,12 +707,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "object"
|
|
||||||
version = "0.20.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.4.1"
|
version = "1.4.1"
|
||||||
|
@ -1021,12 +954,6 @@ version = "0.1.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea509065eb0b3c446acdd0102f0d46567dc30902dc0be91d6552035d92b0f4f8"
|
checksum = "ea509065eb0b3c446acdd0102f0d46567dc30902dc0be91d6552035d92b0f4f8"
|
||||||
|
|
||||||
[[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"
|
||||||
|
@ -1243,23 +1170,14 @@ dependencies = [
|
||||||
"opaque-debug",
|
"opaque-debug",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shared_failure"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "95950ce835eb54ad4d85f5f597a3d7f78cb0f6622f65dabc2dac915d9edc404a"
|
|
||||||
dependencies = [
|
|
||||||
"failure",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shiny-robots"
|
name = "shiny-robots"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
"badge",
|
"badge",
|
||||||
"cadence",
|
"cadence",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"failure",
|
|
||||||
"futures",
|
"futures",
|
||||||
"hyper 0.11.27",
|
"hyper 0.11.27",
|
||||||
"hyper-tls",
|
"hyper-tls",
|
||||||
|
@ -1274,7 +1192,6 @@ dependencies = [
|
||||||
"semver 0.11.0",
|
"semver 0.11.0",
|
||||||
"serde 1.0.116",
|
"serde 1.0.116",
|
||||||
"serde_json 1.0.57",
|
"serde_json 1.0.57",
|
||||||
"shared_failure",
|
|
||||||
"slog",
|
"slog",
|
||||||
"slog-json",
|
"slog-json",
|
||||||
"tokio-core",
|
"tokio-core",
|
||||||
|
@ -1339,18 +1256,6 @@ dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "synstructure"
|
|
||||||
version = "0.12.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"unicode-xid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "take"
|
name = "take"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -13,9 +13,9 @@ members = [
|
||||||
[dependencies]
|
[dependencies]
|
||||||
badge = { path = "./libs/badge" }
|
badge = { path = "./libs/badge" }
|
||||||
|
|
||||||
|
anyhow = "1"
|
||||||
cadence = "0.13"
|
cadence = "0.13"
|
||||||
derive_more = "0.99"
|
derive_more = "0.99"
|
||||||
failure = "0.1"
|
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
hyper = "0.11"
|
hyper = "0.11"
|
||||||
hyper-tls = "0.1"
|
hyper-tls = "0.1"
|
||||||
|
@ -29,7 +29,6 @@ rustsec = "0.6.0"
|
||||||
semver = { version = "0.11", features = ["serde"] }
|
semver = { version = "0.11", features = ["serde"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
shared_failure = "0.1"
|
|
||||||
slog = "2"
|
slog = "2"
|
||||||
slog-json = "2"
|
slog-json = "2"
|
||||||
tokio-core = "0.1"
|
tokio-core = "0.1"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::stream::futures_unordered;
|
use futures::stream::futures_unordered;
|
||||||
use futures::{Future, Poll, Stream};
|
use futures::{Future, Poll, Stream};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::stream::FuturesOrdered;
|
use futures::stream::FuturesOrdered;
|
||||||
use futures::{try_ready, Async, Future, Poll, Stream};
|
use futures::{try_ready, Async, Future, Poll, Stream};
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use cadence::prelude::*;
|
use cadence::prelude::*;
|
||||||
use cadence::{MetricSink, NopMetricSink, StatsdClient};
|
use cadence::{MetricSink, NopMetricSink, StatsdClient};
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::future::join_all;
|
use futures::future::join_all;
|
||||||
use futures::{future, Future};
|
use futures::{future, Future};
|
||||||
use hyper::client::HttpConnector;
|
use hyper::client::HttpConnector;
|
||||||
|
@ -176,7 +176,7 @@ impl Engine {
|
||||||
.iter()
|
.iter()
|
||||||
.find(|release| release.version == crate_path.version)
|
.find(|release| release.version == crate_path.version)
|
||||||
{
|
{
|
||||||
None => future::Either::A(future::err(format_err!(
|
None => future::Either::A(future::err(anyhow!(
|
||||||
"could not find crate release with version {}",
|
"could not find crate release with version {}",
|
||||||
crate_path.version
|
crate_path.version
|
||||||
))),
|
))),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use hyper::Uri;
|
use hyper::Uri;
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::{future, Future, IntoFuture, Stream};
|
use futures::{future, Future, IntoFuture, Stream};
|
||||||
use hyper::{Error as HyperError, Method, Request, Response, Uri};
|
use hyper::{Error as HyperError, Method, Request, Response, Uri};
|
||||||
use semver::{Version, VersionReq};
|
use semver::{Version, VersionReq};
|
||||||
|
@ -100,7 +100,7 @@ where
|
||||||
Box::new(self.0.call(request).from_err().and_then(move |response| {
|
Box::new(self.0.call(request).from_err().and_then(move |response| {
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
if !status.is_success() {
|
if !status.is_success() {
|
||||||
try_future!(Err(format_err!("Status code {} for URI {}", status, uri)));
|
try_future!(Err(anyhow!("Status code {} for URI {}", status, uri)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let body_future = response.body().concat2().from_err();
|
let body_future = response.body().concat2().from_err();
|
||||||
|
@ -174,7 +174,7 @@ where
|
||||||
service.call(request).from_err().and_then(move |response| {
|
service.call(request).from_err().and_then(move |response| {
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
if !status.is_success() {
|
if !status.is_success() {
|
||||||
future::Either::A(future::err(format_err!(
|
future::Either::A(future::err(anyhow!(
|
||||||
"Status code {} for URI {}",
|
"Status code {} for URI {}",
|
||||||
status,
|
status,
|
||||||
uri
|
uri
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::{Future, Stream};
|
use futures::{Future, Stream};
|
||||||
use hyper::header::UserAgent;
|
use hyper::header::UserAgent;
|
||||||
use hyper::{Error as HyperError, Method, Request, Response, Uri};
|
use hyper::{Error as HyperError, Method, Request, Response, Uri};
|
||||||
|
@ -66,7 +66,7 @@ where
|
||||||
Box::new(self.0.call(request).from_err().and_then(|response| {
|
Box::new(self.0.call(request).from_err().and_then(|response| {
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
if !status.is_success() {
|
if !status.is_success() {
|
||||||
try_future!(Err(format_err!(
|
try_future!(Err(anyhow!(
|
||||||
"Status code {} for popular repo search",
|
"Status code {} for popular repo search",
|
||||||
status
|
status
|
||||||
)));
|
)));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use hyper::Uri;
|
use hyper::Uri;
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::{Future, Stream};
|
use futures::{Future, Stream};
|
||||||
use hyper::{Error as HyperError, Method, Request, Response};
|
use hyper::{Error as HyperError, Method, Request, Response};
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
|
@ -38,7 +38,7 @@ where
|
||||||
Box::new(self.0.call(request).from_err().and_then(move |response| {
|
Box::new(self.0.call(request).from_err().and_then(move |response| {
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
if !status.is_success() {
|
if !status.is_success() {
|
||||||
try_future!(Err(format_err!("Status code {} for URI {}", status, uri)));
|
try_future!(Err(anyhow!("Status code {} for URI {}", status, uri)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let body_future = response.body().concat2().from_err();
|
let body_future = response.body().concat2().from_err();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::{future, Future, IntoFuture, Stream};
|
use futures::{future, Future, IntoFuture, Stream};
|
||||||
use hyper::{Error as HyperError, Method, Request, Response};
|
use hyper::{Error as HyperError, Method, Request, Response};
|
||||||
use rustsec::db::AdvisoryDatabase;
|
use rustsec::db::AdvisoryDatabase;
|
||||||
|
@ -32,7 +32,7 @@ where
|
||||||
service.call(request).from_err().and_then(|response| {
|
service.call(request).from_err().and_then(|response| {
|
||||||
let status = response.status();
|
let status = response.status();
|
||||||
if !status.is_success() {
|
if !status.is_success() {
|
||||||
future::Either::A(future::err(format_err!(
|
future::Either::A(future::err(anyhow!(
|
||||||
"Status code {} when fetching advisory db",
|
"Status code {} when fetching advisory db",
|
||||||
status
|
status
|
||||||
)))
|
)))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#![deny(rust_2018_idioms)]
|
#![deny(rust_2018_idioms)]
|
||||||
|
#![allow(unused)]
|
||||||
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate failure;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate try_future;
|
extern crate try_future;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
use semver::{Version, VersionReq};
|
use semver::{Version, VersionReq};
|
||||||
|
@ -51,7 +51,7 @@ impl FromStr for CrateName {
|
||||||
.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-');
|
.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-');
|
||||||
|
|
||||||
if !is_valid {
|
if !is_valid {
|
||||||
Err(format_err!("failed to validate crate name: {}", input))
|
Err(anyhow!("failed to validate crate name: {}", input))
|
||||||
} else {
|
} else {
|
||||||
Ok(CrateName(input.to_string()))
|
Ok(CrateName(input.to_string()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Repository {
|
pub struct Repository {
|
||||||
|
@ -50,7 +50,7 @@ impl FromStr for RepoSite {
|
||||||
"github" => Ok(RepoSite::Github),
|
"github" => Ok(RepoSite::Github),
|
||||||
"gitlab" => Ok(RepoSite::Gitlab),
|
"gitlab" => Ok(RepoSite::Gitlab),
|
||||||
"bitbucket" => Ok(RepoSite::Bitbucket),
|
"bitbucket" => Ok(RepoSite::Bitbucket),
|
||||||
_ => Err(format_err!("unknown repo site identifier")),
|
_ => Err(anyhow!("unknown repo site identifier")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
use semver::VersionReq;
|
use semver::VersionReq;
|
||||||
|
@ -132,9 +132,7 @@ pub fn parse_manifest_toml(input: &str) -> Result<CrateManifest, Error> {
|
||||||
deps,
|
deps,
|
||||||
members,
|
members,
|
||||||
}),
|
}),
|
||||||
(None, None) => Err(format_err!(
|
(None, None) => Err(anyhow!("neither workspace nor package found in manifest")),
|
||||||
"neither workspace nor package found in manifest"
|
|
||||||
)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,10 @@ use std::ops::Deref;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use failure::Error;
|
use anyhow::{anyhow, ensure, Error};
|
||||||
use futures::future::{FromErr, Shared, SharedItem};
|
use futures::future::{FromErr, Shared, SharedItem};
|
||||||
use futures::{Future, Poll};
|
use futures::{Future, Poll};
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use shared_failure::SharedFailure;
|
|
||||||
use tokio_service::Service;
|
use tokio_service::Service;
|
||||||
|
|
||||||
pub struct Cache<S>
|
pub struct Cache<S>
|
||||||
|
@ -18,7 +17,7 @@ where
|
||||||
{
|
{
|
||||||
inner: S,
|
inner: S,
|
||||||
duration: Duration,
|
duration: Duration,
|
||||||
cache: Mutex<LruCache<S::Request, (Instant, Shared<FromErr<S::Future, SharedFailure>>)>>,
|
cache: Mutex<LruCache<S::Request, (Instant, Shared<FromErr<S::Future, Error>>)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> Debug for Cache<S>
|
impl<S> Debug for Cache<S>
|
||||||
|
@ -55,7 +54,7 @@ where
|
||||||
{
|
{
|
||||||
type Request = S::Request;
|
type Request = S::Request;
|
||||||
type Response = CachedItem<S::Response>;
|
type Response = CachedItem<S::Response>;
|
||||||
type Error = SharedFailure;
|
type Error = Error;
|
||||||
type Future = Cached<S::Future>;
|
type Future = Cached<S::Future>;
|
||||||
|
|
||||||
fn call(&self, req: Self::Request) -> Self::Future {
|
fn call(&self, req: Self::Request) -> Self::Future {
|
||||||
|
@ -74,7 +73,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Cached<F: Future<Error = Error>>(Shared<FromErr<F, SharedFailure>>);
|
pub struct Cached<F: Future<Error = Error>>(Shared<FromErr<F, Error>>);
|
||||||
|
|
||||||
impl<F> Debug for Cached<F>
|
impl<F> Debug for Cached<F>
|
||||||
where
|
where
|
||||||
|
@ -88,13 +87,13 @@ where
|
||||||
|
|
||||||
impl<F: Future<Error = Error>> Future for Cached<F> {
|
impl<F: Future<Error = Error>> Future for Cached<F> {
|
||||||
type Item = CachedItem<F::Item>;
|
type Item = CachedItem<F::Item>;
|
||||||
type Error = SharedFailure;
|
type Error = Error;
|
||||||
|
|
||||||
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
|
||||||
self.0
|
self.0
|
||||||
.poll()
|
.poll()
|
||||||
.map_err(|err| (*err).clone())
|
.map_err(|_err| anyhow!("TODO: shared error not clone-able"))
|
||||||
.map(|_async| _async.map(CachedItem))
|
.map(|item| item.map(CachedItem))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue