Skip to content

Commit dd3fd60

Browse files
committed
feat: use safe API for rkyv access
1 parent 326b325 commit dd3fd60

File tree

10 files changed

+98
-57
lines changed

10 files changed

+98
-57
lines changed

Cargo.lock

Lines changed: 64 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ odict = { path = "../lib", features = [
2121
] }
2222
internal = { path = "../internal", features = ["load"] }
2323
clap = { version = "4.5.47", features = ["derive", "cargo"] }
24-
console = "0.16.0"
24+
console = "0.16.1"
2525
indicatif = "0.18.0"
2626
pulldown-cmark = "0.13.0"
2727
actix-web = "4.11.0"
28-
serde = { version = "1.0.219", features = ["derive"] }
28+
serde = { version = "1.0.221", features = ["derive"] }
2929
env_logger = "0.11.8"
3030
derive_more = { version = "2", features = ["display", "error"] }
3131
num-format = "0.4.4"
3232
anyhow = "1.0.99"
33-
lru = "0.16.0"
33+
lru = "0.16.1"
3434
tokio = { version = "1.47", features = ["full"] }

lib/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ quick-xml = { version = "0.38.3", features = ["serialize"] }
5757
rayon = "1.11.0"
5858
charabia = { version = "0.9.7", optional = true, default-features = false }
5959
rkyv = { version = "0.8.11" }
60-
serde = { version = "1.0.219", features = ["serde_derive"] }
60+
serde = { version = "1.0.221", features = ["serde_derive"] }
6161
uuid = { version = "1.18.1", features = [
6262
"v4",
6363
"fast-rng",
6464
"macro-diagnostics",
6565
] }
6666
url = "2.5.7"
67-
serde_json = "1.0.143"
67+
serde_json = "1.0.145"
6868
thiserror = "2.0.16"
6969
brotli = "8.0.2"
7070
structural-convert = { workspace = true }
@@ -91,11 +91,11 @@ strum = { version = "0.27.2", features = ["derive"] }
9191

9292
[dev-dependencies]
9393
criterion = { version = "0.7.0", features = ["async_tokio", "html_reports"] }
94-
insta = "1.43.1"
94+
insta = "1.43.2"
9595
map-macro = { version = "0.3.0" }
9696
tokio = { version = "1.47.1", features = ["rt", "macros"] }
9797
wiremock = "0.6.5"
98-
tempfile = "3.21.0"
98+
tempfile = "3.22.0"
9999
regex = "1.11.2"
100100

101101
[lib]

lib/src/core/read.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ where
4949
let version = SemanticVersion::from(version_bytes);
5050

5151
if !version.is_compatible(&VERSION) {
52-
return Err(Error::Incompatible);
52+
return Err(Error::Incompatible(
53+
version.to_string(),
54+
VERSION.to_string(),
55+
));
5356
}
5457

5558
Ok(version)

lib/src/error.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ pub enum Error {
4646
#[error("Invalid remote dictionary name: {0}")]
4747
InvalidDictionaryName(String),
4848

49-
#[error("This file is not compatible with the current version of ODict")]
50-
Incompatible,
49+
#[error("This file version ({0}) is not compatible with the current version of ODict ({1})")]
50+
Incompatible(String, String),
51+
52+
#[error("The input buffer is invalid or corrupted")]
53+
InvalidBuffer(#[from] rkyv::rancor::Error),
5154

5255
#[error("The input does not have a valid ODict file signature")]
5356
InvalidSignature,

0 commit comments

Comments
 (0)