From 0571a5f38ba92669437cc95fec41c7517e7fa724 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Sat, 19 Oct 2024 01:45:06 -0600 Subject: [PATCH] Make RabbitEvent enum send as number instead of string (repr) --- Cargo.lock | 1 + Cargo.toml | 1 + src/connectivity/rabbit.rs | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8e9076c..05b74e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -470,6 +470,7 @@ dependencies = [ "rust-s3", "serde", "serde_json", + "serde_repr", "serde_urlencoded", "serde_with", "sha1", diff --git a/Cargo.toml b/Cargo.toml index 5c021f3..cfd2e64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ futures-util = "0.3.30" prometheus-http-query = "0.8.3" influxdb2 = "0.5.1" influxdb2-structmap = "0.2.0" +serde_repr = "0.1.19" [profile.release] lto = true diff --git a/src/connectivity/rabbit.rs b/src/connectivity/rabbit.rs index 9641148..9a38df8 100644 --- a/src/connectivity/rabbit.rs +++ b/src/connectivity/rabbit.rs @@ -6,13 +6,15 @@ use lapin::{ }; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; +use serde_repr::{Deserialize_repr, Serialize_repr}; use crate::{ config::Config, structs::{boosted::BoostedRideUpdate, spotify::CurrentPlaying}, }; -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Serialize_repr, Deserialize_repr, Clone, Debug)] +#[repr(u8)] pub enum RabbitEvent { SpotifyUpdate, BoostedUpdate,