mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-25 03:26:30 +00:00
use external shared_failure crate
This commit is contained in:
parent
c4337ae698
commit
ad2d993b68
4 changed files with 5 additions and 50 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -684,8 +684,9 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "shared-failure"
|
||||
name = "shared_failure"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -711,7 +712,7 @@ dependencies = [
|
|||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"shared-failure 0.1.0",
|
||||
"shared_failure 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1038,6 +1039,7 @@ dependencies = [
|
|||
"checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0"
|
||||
"checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5"
|
||||
"checksum serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9db7266c7d63a4c4b7fe8719656ccdd51acf1bed6124b174f933b009fb10bcb"
|
||||
"checksum shared_failure 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95950ce835eb54ad4d85f5f597a3d7f78cb0f6622f65dabc2dac915d9edc404a"
|
||||
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
|
||||
"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d"
|
||||
"checksum slog 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6b13b17f4225771f7f15cece704a4e68d3a5f31278ed26367f497133398a18"
|
||||
|
|
|
@ -19,6 +19,7 @@ semver = { version = "0.9.0", features = ["serde"] }
|
|||
serde = "1.0.27"
|
||||
serde_derive = "1.0.27"
|
||||
serde_json = "1.0.9"
|
||||
shared_failure = "0.1.0"
|
||||
slog = "2.1.1"
|
||||
slog-json = "2.2.0"
|
||||
tokio-core = "0.1.12"
|
||||
|
@ -29,9 +30,5 @@ toml = "0.4.5"
|
|||
version = "0.2.0"
|
||||
path = "libs/badge"
|
||||
|
||||
[dependencies.shared-failure]
|
||||
version = "0.1.0"
|
||||
path = "libs/shared-failure"
|
||||
|
||||
[build-dependencies]
|
||||
sass-rs = "0.2.1"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[package]
|
||||
name = "shared-failure"
|
||||
version = "0.1.0"
|
||||
authors = ["Sam Rijs <srijs@airpost.net>"]
|
||||
|
||||
[dependencies]
|
||||
failure = "0.1.1"
|
|
@ -1,37 +0,0 @@
|
|||
extern crate failure;
|
||||
|
||||
use std::fmt::{Display, Formatter, Result as FmtResult};
|
||||
use std::sync::Arc;
|
||||
|
||||
use failure::{Backtrace, Error, Fail};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct SharedFailure(Arc<Error>);
|
||||
|
||||
impl SharedFailure {
|
||||
pub fn downcast_ref<T: Fail>(&self) -> Option<&T> {
|
||||
self.0.downcast_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl Fail for SharedFailure {
|
||||
fn cause(&self) -> Option<&Fail> {
|
||||
Some(self.0.cause())
|
||||
}
|
||||
|
||||
fn backtrace(&self) -> Option<&Backtrace> {
|
||||
Some(self.0.backtrace())
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for SharedFailure {
|
||||
fn fmt(&self, f: &mut Formatter) -> FmtResult {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Error> for SharedFailure {
|
||||
fn from(err: Error) -> SharedFailure {
|
||||
SharedFailure(Arc::new(err))
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue