From 2d29dddca008dfc6763f00bae1b28bb702697a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20P=C5=82aczek?= Date: Sat, 4 Jan 2025 22:43:14 +0000 Subject: [PATCH] feat: use `serde_bytes` --- backend/Cargo.lock | 10 ++++++++++ backend/Cargo.toml | 1 + backend/src/web/app.rs | 1 + 3 files changed, 12 insertions(+) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index c9e85aa..a8af4e2 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -1524,6 +1524,7 @@ dependencies = [ "playwright", "rust-embed", "serde", + "serde_bytes", "serde_json", "sqlx", "tempfile", @@ -2104,6 +2105,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.216" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index b3148bf..d90a494 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -40,6 +40,7 @@ opencv = { workspace = true } tokio-util = { version = "0.7.12", features = ["rt"] } axum-embed = "0.1.0" rust-embed = "8.5.0" +serde_bytes = "0.11.15" [dev-dependencies] playwright = { version = "0.0.20", default-features = false, features = ["rt-tokio"] } diff --git a/backend/src/web/app.rs b/backend/src/web/app.rs index e4957ad..0099a88 100644 --- a/backend/src/web/app.rs +++ b/backend/src/web/app.rs @@ -74,6 +74,7 @@ struct EmbeddedAssets; pub struct ImageContainer { pub camera_id: i64, pub timestamp: i64, + #[serde(with = "serde_bytes")] pub image_bytes: Vec, }