winterbaume_iotdataplane/
types.rs1use chrono::{DateTime, Utc};
2
3#[derive(Debug, Clone)]
5pub struct ThingShadow {
6 pub thing_name: String,
7 pub shadow_name: Option<String>,
8 pub payload: Vec<u8>,
9 pub version: i64,
10 pub last_modified: DateTime<Utc>,
11}
12
13#[derive(Debug, Clone, Hash, Eq, PartialEq)]
16pub struct ShadowKey {
17 pub thing_name: String,
18 pub shadow_name: Option<String>,
19}
20
21impl ShadowKey {
22 pub fn classic(thing_name: &str) -> Self {
23 Self {
24 thing_name: thing_name.to_string(),
25 shadow_name: None,
26 }
27 }
28
29 pub fn named(thing_name: &str, shadow_name: &str) -> Self {
30 Self {
31 thing_name: thing_name.to_string(),
32 shadow_name: Some(shadow_name.to_string()),
33 }
34 }
35}
36
37#[derive(Debug, Clone)]
39pub struct PublishedMessage {
40 pub topic: String,
41 pub payload: Vec<u8>,
42 pub qos: i32,
43 pub retain: bool,
44 pub published_at: DateTime<Utc>,
45}
46
47#[derive(Debug, Clone)]
49pub struct RetainedMessage {
50 pub topic: String,
51 pub payload: Vec<u8>,
52 pub qos: i32,
53 pub last_modified: DateTime<Utc>,
54}