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
/// Create an [`SgMap`][crate::map::SgMap] from a list of key-value pairs. Capacity precedes the list.
///
/// # Examples
///
/// ```
/// use scapegoat::{SgMap, sgmap};
///
/// let mut map = sgmap! {
/// 4, // Const capacity
/// "a" => 0x61,
/// "b" => 0x62,
/// "c" => 0x63,
/// };
///
/// assert_eq!(map["a"], 0x61);
/// assert_eq!(map["b"], 0x62);
/// assert_eq!(map["c"], 0x63);
///
/// assert_eq!(map.get("d"), None);
/// assert_eq!(map.capacity(), 4);
/// assert_eq!(map.len(), 3);
///
/// map.insert("d", 0x64);
/// assert_eq!(map["d"], 0x64);
/// ```
/// Create an [`SgSet`][crate::set::SgSet] from a list of values. Capacity precedes the list.
///
/// # Examples
///
/// ```
/// use scapegoat::{SgSet, sgset};
///
/// let mut set = sgset! {
/// 4, // Const capacity
/// "a",
/// "b",
/// "c",
/// };
///
/// assert_eq!(set.get("d"), None);
/// assert_eq!(set.capacity(), 4);
/// assert_eq!(set.len(), 3);
///
/// set.insert("d");
/// assert_eq!(set.get("d"), Some(&"d"));
/// ```