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
use crate::{node::{CNode, LNode, SNode}, traits::*};
use alloc::sync::Arc;
#[derive(Debug)]
#[must_use]
pub enum BitError {
CountNotEqualToOne,
Found,
NotFound,
Range,
}
#[must_use]
pub(crate) enum FindResult<'a, V: Value> {
NotFound,
Found(&'a V),
}
#[must_use]
pub(crate) enum InsertResult<'a, H: Hashword, F: Flagword<H>, V: Value, M: 'static> {
Found(&'a V),
InsertedC(CNode<H, F, V, M>, Option<&'a V>),
InsertedL(Arc<LNode<V>>, Option<&'a V>),
InsertedS(Arc<SNode<V>>, Option<&'a V>),
}
#[must_use]
pub(crate) enum RemoveResult<'a, H: Hashword, F: Flagword<H>, V: Value, M: 'static> {
NotFound,
RemovedC(CNode<H, F, V, M>, &'a V),
RemovedL(Arc<LNode<V>>, &'a V),
RemovedS(Arc<SNode<V>>, &'a V),
RemovedZ(&'a V),
}
#[must_use]
pub(crate) enum LNodeRemoveResult<'a, V: Value> {
NotFound,
RemovedL(Arc<LNode<V>>, &'a V),
RemovedS(Arc<SNode<V>>, &'a V),
}
#[must_use]
pub(crate) enum SNodeRemoveResult<'a, V: Value> {
NotFound,
RemovedZ(&'a V),
}
#[cfg(test)]
macro_rules! assert_found_eq {
( $found:expr, $expected:expr ) => {
match $found {
FindResult::Found(reference) => assert_eq!(*reference, $expected),
FindResult::NotFound => panic!()
}
};
}
#[cfg(test)]
macro_rules! assert_found_none {
( $found:expr ) => {
match $found {
FindResult::Found(_reference) => panic!(),
FindResult::NotFound => {}
}
};
}