From 22b1be0390088ec5e2bed88928624b7491c40d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Tue, 22 Oct 2024 23:08:00 +0200 Subject: [PATCH] Replace JSON with CBOR --- Cargo.toml | 2 +- src/error.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3c4b5bb..c6b9f1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ members = ["examples"] tokio = { version = "1.*", default-features = false, features = [] } serde = { version = "1.0.*", default-features = false, features = ["std", "derive"] } chrono = { version = "0.4.*", default-features = false, features = ["std", "now", "serde"] } -serde_json = { version = "1.0.*", default-features = false, features = ["std"] } +ciborium = { version = "0.2.*", default-features = false, features = ["std"] } redis = { version = "0.23.*", default-features = false, features = ["serde", "aio", "tokio-comp"] } redlock = { version = "2.0.*", default-features = false } tracing = { version = "0.1.*", default-features = false, features = ["attributes"] } diff --git a/src/error.rs b/src/error.rs index 1c2692c..948316b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -14,8 +14,14 @@ impl From for CacheError { } } -impl From for CacheError { - fn from(value: serde_json::Error) -> Self { +impl From> for CacheError { + fn from(value: ciborium::ser::Error) -> Self { + Self::Serde(value.to_string()) + } +} + +impl From> for CacheError { + fn from(value: ciborium::de::Error) -> Self { Self::Serde(value.to_string()) } }