@@ -23,17 +23,17 @@ pub trait PageSize: Copy + Eq + PartialOrd + Ord + Sealed {
23
23
pub trait NotGiantPageSize : PageSize { }
24
24
25
25
/// A standard 4KiB page.
26
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
26
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
27
27
pub enum Size4KiB { }
28
28
29
29
/// A “huge” 2MiB page.
30
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
30
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
31
31
pub enum Size2MiB { }
32
32
33
33
/// A “giant” 1GiB page.
34
34
///
35
35
/// (Only available on newer x86_64 CPUs.)
36
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
36
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
37
37
pub enum Size1GiB { }
38
38
39
39
impl PageSize for Size4KiB {
@@ -429,6 +429,15 @@ impl fmt::Display for AddressNotAligned {
429
429
mod tests {
430
430
use super :: * ;
431
431
432
+ fn test_is_hash < T : core:: hash:: Hash > ( ) { }
433
+
434
+ #[ test]
435
+ pub fn test_page_is_hash ( ) {
436
+ test_is_hash :: < Page < Size4KiB > > ( ) ;
437
+ test_is_hash :: < Page < Size2MiB > > ( ) ;
438
+ test_is_hash :: < Page < Size1GiB > > ( ) ;
439
+ }
440
+
432
441
#[ test]
433
442
pub fn test_page_ranges ( ) {
434
443
let page_size = Size4KiB :: SIZE ;
0 commit comments