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
import_stdlib!;
use crate::;
/// # Boolean Values in dCBOR
///
/// dCBOR supports boolean values through the major type 7 (simple values),
/// where `false` is encoded as 0xf4 and `true` as 0xf5.
///
/// Per the dCBOR specification, only a limited set of simple values are valid:
/// - Boolean values (`true`, `false`)
/// - `null`
/// - Floating point values
///
/// ## Examples
///
/// ```
/// use dcbor::prelude::*;
///
/// // Create CBOR from boolean values using `into()`
/// let cbor_true: CBOR = true.into();
/// let cbor_false: CBOR = false.into();
///
/// // Use in collections
/// let array: Vec<CBOR> = vec![true.into(), false.into(), 42.into()];
/// let cbor_array: CBOR = array.into();
///
/// // Maps can use boolean keys
/// let mut map = Map::new();
/// map.insert(true, "this is true");
/// map.insert(false, "this is false");
///
/// // Convert back to boolean
/// let value: bool = cbor_true.try_into().unwrap();
/// assert_eq!(value, true);
/// ```