prost_wkt_types/
pbempty.rs

1include!(concat!(env!("OUT_DIR"), "/pbempty/google.protobuf.rs"));
2
3const EMPTY: Empty = Empty {};
4
5impl From<()> for Empty {
6    fn from(_value: ()) -> Self {
7        EMPTY
8    }
9}
10
11#[cfg(test)]
12mod tests {
13
14    use crate::pbempty::*;
15
16    #[test]
17    fn serialize_empty() {
18        let msg = EMPTY;
19        println!(
20            "Serialized to string: {}",
21            serde_json::to_string_pretty(&msg).unwrap()
22        );
23    }
24
25    #[test]
26    fn deserialize_empty() {
27        let msg: Empty = serde_json::from_str("{}").expect("Could not deserialize `{}` to an Empty struct!");
28        assert_eq!(msg, EMPTY);
29    }
30
31    #[test]
32    fn convert_unit() {
33        let msg: Empty = ().into();
34        assert_eq!(msg, Empty {});
35    }
36}