azure_functions/send_grid/
content.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Default, Clone, Serialize, Deserialize)]
7pub struct Content {
8 #[serde(rename = "type")]
10 pub mime_type: String,
11 pub value: String,
13}
14
15#[cfg(test)]
16mod tests {
17 use super::*;
18 use serde_json::to_string;
19
20 #[test]
21 fn it_serializes_to_json() {
22 let json = to_string(&Content {
23 mime_type: "text/plain".to_owned(),
24 value: "hello world".to_owned(),
25 })
26 .unwrap();
27
28 assert_eq!(json, r#"{"type":"text/plain","value":"hello world"}"#);
29 }
30}