mirror of
https://github.com/mikedilger/chorus.git
synced 2026-08-01 07:21:39 +00:00
depend on speedy
This commit is contained in:
parent
1e2187b86c
commit
72a406cea7
31
Cargo.lock
generated
31
Cargo.lock
generated
@ -175,6 +175,7 @@ dependencies = [
|
||||
"mmap-append",
|
||||
"secp256k1",
|
||||
"serde",
|
||||
"speedy",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
@ -658,6 +659,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.2"
|
||||
@ -1137,6 +1147,27 @@ dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "speedy"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da1992073f0e55aab599f4483c460598219b4f9ff0affa124b33580ab511e25a"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"speedy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "speedy-derive"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "658f2ca5276b92c3dfd65fa88316b4e032ace68f88d7570b43967784c0bac5ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
|
||||
@ -16,6 +16,7 @@ log = "0.4"
|
||||
mmap-append = "0.2"
|
||||
secp256k1 = { version = "0.28", features = [ "hashes", "global-context", "rand-std" ] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
speedy = "0.8"
|
||||
tokio = { version = "1", features = [ "full" ] }
|
||||
tokio-rustls = "0.24"
|
||||
toml = "0.8"
|
||||
|
||||
@ -118,6 +118,9 @@ pub enum ChorusError {
|
||||
// Filter is underspecified
|
||||
Scraper,
|
||||
|
||||
// Speedy
|
||||
Speedy(speedy::Error),
|
||||
|
||||
// Too many errors
|
||||
TooManyErrors,
|
||||
|
||||
@ -184,6 +187,7 @@ impl std::fmt::Display for ChorusError {
|
||||
ChorusError::TimedOut => write!(f, "Timed out"),
|
||||
ChorusError::Tungstenite(e) => write!(f, "{e}"),
|
||||
ChorusError::Scraper => write!(f, "Filter is underspecified. Scrapers are not allowed"),
|
||||
ChorusError::Speedy(e) => write!(f, "{e}"),
|
||||
ChorusError::TooManyErrors => write!(f, "Too many errors"),
|
||||
ChorusError::TooManySubscriptions => write!(f, "Too many subscriptions"),
|
||||
ChorusError::UrlParse(e) => write!(f, "{e}"),
|
||||
@ -206,6 +210,7 @@ impl StdError for ChorusError {
|
||||
ChorusError::Io(e) => Some(e),
|
||||
ChorusError::Lmdb(e) => Some(e),
|
||||
ChorusError::Rustls(e) => Some(e),
|
||||
ChorusError::Speedy(e) => Some(e),
|
||||
ChorusError::Tungstenite(e) => Some(e),
|
||||
ChorusError::UrlParse(e) => Some(e),
|
||||
ChorusError::Utf8(e) => Some(e),
|
||||
@ -250,6 +255,7 @@ impl ChorusError {
|
||||
ChorusError::TimedOut => 0.1,
|
||||
ChorusError::Tungstenite(_) => 0.0,
|
||||
ChorusError::Scraper => 0.5,
|
||||
ChorusError::Speedy(_) => 0.0,
|
||||
ChorusError::TooManyErrors => 1.0,
|
||||
ChorusError::TooManySubscriptions => 0.1,
|
||||
ChorusError::UrlParse(_) => 0.1,
|
||||
@ -406,3 +412,13 @@ impl From<url::ParseError> for Error {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<speedy::Error> for Error {
|
||||
#[track_caller]
|
||||
fn from(err: speedy::Error) -> Self {
|
||||
Error {
|
||||
inner: ChorusError::Speedy(err),
|
||||
location: std::panic::Location::caller(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user