MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / assert_empty

Function assert_empty

crates/data-structures/src/small_map.rs:213–228  ·  view source on GitHub ↗

Asserts that the map behaves consistently as an empty map.

(map: &mut Map<N, { M }>, key: &K, val: V)

Source from the content-addressed store, hash-verified

211
212 /// Asserts that the map behaves consistently as an empty map.
213 fn assert_empty<const N: usize, const M: usize>(map: &mut Map<N, { M }>, key: &K, val: V) {
214 assert!(map.is_empty());
215 assert_eq!(map.len(), 0);
216
217 assert_eq!(map.iter().count(), 0);
218 assert_eq!(map.keys().count(), 0);
219 assert_eq!(map.values().count(), 0);
220
221 assert_eq!(Map::<N, M>::key_pos(&[], key), None);
222 assert!(!map.contains_key(key));
223 assert_eq!(map.get(key), None);
224 assert_eq!(map.get_mut(key), None);
225
226 assert_eq!(map.remove(key), None);
227 assert_eq!(map.insert(*key, val), None);
228 }
229
230 /// Asserts that the map behaves consistently as a non-empty map.
231 fn assert_not_empty<const N: usize, const M: usize>(map: &mut Map<N, M>, len: usize) {

Callers 1

extend_clearFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…