Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created September 30, 2021 14:37
Show Gist options
  • Save ntakouris/a7a21d9476898cd468a0d3af273b6b2f to your computer and use it in GitHub Desktop.
Save ntakouris/a7a21d9476898cd468a0d3af273b6b2f to your computer and use it in GitHub Desktop.
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct CaptionedImageValue {
pub caption: String,
pub contents_b64: String
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum EventValue {
String(String),
Float(f32),
Int(i32),
Bool(bool),
CaptionedImage(CaptionedImageValue)
}
#[derive(Serialize, Deserialize, Debug)]
pub struct EventEntity {
// whatever other metadata you need
pub id: String,
pub value: EventValue
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment