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
pub use *;
/// Like [`Display`], but [`'static`], no_std and no_alloc.
///
/// See also [`OptionalDescription`]
///
/// # Example
///
/// ```rust
/// # use description::Description;
///
/// #[derive(Description)]
/// enum ChargerStatus {
/// #[description("Charger connected!")]
/// Connected,
///
/// #[description("Charger disconnected!")]
/// Disconnected,
/// }
///
/// fn main() {
/// let charger = ChargerStatus::Connected;
///
/// println!("Charger notification: {}", charger.description());
/// // Charger notification: Charger connected!
/// }
/// ```
/// Like [`Display`], but [`'static`], no_std and no_alloc.
///
/// See also [`Description`]
///
/// # Example
///
/// ```rust
/// #[derive(OptionalDescription)]
/// enum BatteryStatus {
/// Okay,
///
/// #[description("Low battery!")]
/// LowBattery,
///
/// #[description("Fully charged! Please remove the charger.")]
/// FullyCharged,
/// }
///
/// fn main() {
/// let battery1 = BatteryStatus::LowBattery;
///
/// let battery2 = BatteryStatus::Okay;
///
/// if let Some(description) = battery1.description() {
/// println!("Battery notification: {}", description);
/// }
///
/// if let Some(description) = battery2.description() {
/// println!("Battery notification: {}", description);
/// }
///
/// // Battery notification: Low battery!
/// //
/// }
///```