1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
pub mod smalltalk {
//! # SmallTalk Ad-hoc Dialect
//!
//! This is a simple ad-hoc dialect that can be used in doc tests to showcase ad-hoc dialect
//! construction.
//!
//! # Examples
//!
//! ```rust,no_run
//! use maviola::test_utils::smalltalk::*;
//!
//! let message = SmallTalk::Howdy(Howdy{
//! mood: Mood::Delighted
//! });
//! ```
use crate::protocol::derive::{Dialect, Enum, Message};
use crate::protocol::dialects::minimal::messages::Heartbeat;
use crate::protocol::mavspec;
/// Communication mood.
#[repr(u8)]
#[derive(Copy, Clone, Debug, Default, Enum)]
pub enum Mood {
/// Speaks politely.
#[default]
Polite = 0,
/// Dead serious.
Serious = 1,
/// Not in the mood.
Grumpy = 2,
/// Delighted on the verge of delusion.
Delighted = 3,
/// Confused and distracted.
Confused = 4,
}
/// "How are you?" rhetorical question.
///
/// Well, maybe not always rhetorical.
#[derive(Clone, Debug, Message)]
#[message_id(72000)]
pub struct Howdy {
/// Communication mood.
#[base_type(u8)]
pub mood: Mood,
}
/// I'm good, fine.
#[derive(Clone, Debug, Message)]
#[message_id(72001)]
pub struct Good {
/// Communication mood.
#[base_type(u8)]
pub mood: Mood,
}
/// Returns the previous question
#[derive(Clone, Debug, Message)]
#[message_id(72002)]
pub struct AndYou {
/// Communication mood.
#[base_type(u8)]
pub mood: Mood,
}
/// A strange claim.
#[derive(Clone, Debug, Message)]
#[message_id(72003)]
pub struct NonSequitur {
/// Communication mood.
#[base_type(u8)]
pub mood: Mood,
}
/// Returned on confusion.
#[derive(Clone, Debug, Message)]
#[message_id(72004)]
pub struct Wat {
/// Communication mood.
#[base_type(u8)]
pub mood: Mood,
}
/// SmallTalk Ad-hoc Dialect.
#[derive(Dialect)]
#[dialect(1099)]
#[version(99)]
pub enum SmallTalk {
/// We want to be compatible with heartbeat protocol.
Heartbeat(Heartbeat),
/// — How are you?
Howdy(Howdy),
/// — Good.
Good(Good),
/// — And you?
AndYou(AndYou),
/// — I don't have a precise answer to your question. It was raining this morning. A black
/// terrier jumped over a bench scaring a flock of birds. My coffee becomes cold as I was
/// watching the clouds changing their elusive shape. When suddenly...
NonSequitur(NonSequitur),
/// — WAT!!!
Wat(Wat),
}
}