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