azure_functions/send_grid/
open_tracking.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Default, Clone, Serialize, Deserialize)]
7pub struct OpenTracking {
8 pub enable: bool,
10 #[serde(skip_serializing_if = "Option::is_none")]
14 pub substitution_tag: Option<String>,
15}
16
17#[cfg(test)]
18mod tests {
19 use super::*;
20 use serde_json::to_string;
21
22 #[test]
23 fn it_serializes_to_json() {
24 let json = to_string(&OpenTracking {
25 enable: true,
26 substitution_tag: Some("foo".to_owned()),
27 })
28 .unwrap();
29
30 assert_eq!(json, r#"{"enable":true,"substitution_tag":"foo"}"#);
31 }
32}