@@ -6,6 +6,99 @@ pub use self::iter::{RoIter, RoRevIter, RwIter, RwRevIter};
6
6
pub use self :: prefix:: { RoPrefix , RoRevPrefix , RwPrefix , RwRevPrefix } ;
7
7
pub use self :: range:: { RoRange , RoRevRange , RwRange , RwRevRange } ;
8
8
9
+ /// This is just set of tests to check that the Cursors
10
+ /// are not Send. We need to use doc test as it is the
11
+ /// only way to check for expected compilation failures.
12
+ ///
13
+ /// ```rust,compile_fail
14
+ /// use heed::types::*;
15
+ /// use heed::RoIter;
16
+ /// fn is_send<T: Send>() {}
17
+ /// is_send::<RoIter<Bytes, Bytes>>();
18
+ /// ```
19
+ ///
20
+ /// ```rust,compile_fail
21
+ /// use heed::types::*;
22
+ /// use heed::RoRevIter;
23
+ /// fn is_send<T: Send>() {}
24
+ /// is_send::<RoRevIter<Bytes, Bytes>>();
25
+ /// ```
26
+ ///
27
+ /// ```rust,compile_fail
28
+ /// use heed::types::*;
29
+ /// use heed::RoRange;
30
+ /// fn is_send<T: Send>() {}
31
+ /// is_send::<RoRange<Bytes, Bytes>>();
32
+ /// ```
33
+ ///
34
+ /// ```rust,compile_fail
35
+ /// use heed::types::*;
36
+ /// use heed::RoRevRange;
37
+ /// fn is_send<T: Send>() {}
38
+ /// is_send::<RoRevRange<Bytes, Bytes>>();
39
+ /// ```
40
+ ///
41
+ /// ```rust,compile_fail
42
+ /// use heed::types::*;
43
+ /// use heed::RoPrefix;
44
+ /// fn is_send<T: Send>() {}
45
+ /// is_send::<RoPrefix<Bytes, Bytes>>();
46
+ /// ```
47
+ ///
48
+ /// ```rust,compile_fail
49
+ /// use heed::types::*;
50
+ /// use heed::RoRevPrefix;
51
+ /// fn is_send<T: Send>() {}
52
+ /// is_send::<RoRevPrefix<Bytes, Bytes>>();
53
+ /// ```
54
+ ///
55
+ /// Starting the next section with the Read-write Iterators.
56
+ ///
57
+ /// ```rust,compile_fail
58
+ /// use heed::types::*;
59
+ /// use heed::RwIter;
60
+ /// fn is_send<T: Send>() {}
61
+ /// is_send::<RwIter<Bytes, Bytes>>();
62
+ /// ```
63
+ ///
64
+ /// ```rust,compile_fail
65
+ /// use heed::types::*;
66
+ /// use heed::RwRevIter;
67
+ /// fn is_send<T: Send>() {}
68
+ /// is_send::<RwRevIter<Bytes, Bytes>>();
69
+ /// ```
70
+ ///
71
+ /// ```rust,compile_fail
72
+ /// use heed::types::*;
73
+ /// use heed::RwRange;
74
+ /// fn is_send<T: Send>() {}
75
+ /// is_send::<RwRange<Bytes, Bytes>>();
76
+ /// ```
77
+ ///
78
+ /// ```rust,compile_fail
79
+ /// use heed::types::*;
80
+ /// use heed::RwRevRange;
81
+ /// fn is_send<T: Send>() {}
82
+ /// is_send::<RwRevRange<Bytes, Bytes>>();
83
+ /// ```
84
+ ///
85
+ /// ```rust,compile_fail
86
+ /// use heed::types::*;
87
+ /// use heed::RwPrefix;
88
+ /// fn is_send<T: Send>() {}
89
+ /// is_send::<RwPrefix<Bytes, Bytes>>();
90
+ /// ```
91
+ ///
92
+ /// ```rust,compile_fail
93
+ /// use heed::types::*;
94
+ /// use heed::RwRevPrefix;
95
+ /// fn is_send<T: Send>() {}
96
+ /// is_send::<RwRevPrefix<Bytes, Bytes>>();
97
+ /// ```
98
+ #[ doc( hidden) ]
99
+ #[ allow( unused) ]
100
+ fn test_txns_are_not_send ( ) { }
101
+
9
102
#[ cfg( test) ]
10
103
mod tests {
11
104
use std:: ops;
0 commit comments