1 #![doc = include_str!("../README.md")] 2 #![deny(rust_2018_idioms)] 3 #![deny(missing_docs)] 4 #![deny(unnameable_types)] 5 #![cfg_attr(not(feature = "std"), no_std)] 6 #![cfg_attr(docsrs, feature(doc_cfg))] 7 8 #[cfg(all( 9 feature = "alloc", 10 any(feature = "xxhash3_64", feature = "xxhash3_128") 11 ))] 12 extern crate alloc; 13 14 #[cfg(any(feature = "std", doc, test))] 15 extern crate std; 16 17 #[cfg(feature = "xxhash32")] 18 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash32")))] 19 pub mod xxhash32; 20 21 #[cfg(feature = "xxhash32")] 22 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash32")))] 23 pub use xxhash32::Hasher as XxHash32; 24 25 #[cfg(feature = "xxhash64")] 26 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash64")))] 27 pub mod xxhash64; 28 29 #[cfg(feature = "xxhash64")] 30 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash64")))] 31 pub use xxhash64::Hasher as XxHash64; 32 33 #[cfg(any(feature = "xxhash3_64", feature = "xxhash3_128"))] 34 mod xxhash3; 35 36 #[cfg(feature = "xxhash3_64")] 37 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash3_64")))] 38 pub mod xxhash3_64; 39 40 #[cfg(feature = "xxhash3_64")] 41 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash3_64")))] 42 pub use xxhash3_64::Hasher as XxHash3_64; 43 44 #[cfg(feature = "xxhash3_128")] 45 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash3_128")))] 46 pub mod xxhash3_128; 47 48 #[cfg(feature = "xxhash3_128")] 49 #[cfg_attr(docsrs, doc(cfg(feature = "xxhash3_128")))] 50 pub use xxhash3_128::Hasher as XxHash3_128; 51 52 #[allow(dead_code, reason = "Too lazy to cfg-gate these")] 53 trait IntoU32 { into_u32(self) -> u3254 fn into_u32(self) -> u32; 55 } 56 57 impl IntoU32 for u8 { into_u32(self) -> u3258 fn into_u32(self) -> u32 { 59 self.into() 60 } 61 } 62 63 #[allow(dead_code, reason = "Too lazy to cfg-gate these")] 64 trait IntoU64 { into_u64(self) -> u6465 fn into_u64(self) -> u64; 66 } 67 68 impl IntoU64 for u8 { into_u64(self) -> u6469 fn into_u64(self) -> u64 { 70 self.into() 71 } 72 } 73 74 impl IntoU64 for u32 { into_u64(self) -> u6475 fn into_u64(self) -> u64 { 76 self.into() 77 } 78 } 79 80 #[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] 81 impl IntoU64 for usize { into_u64(self) -> u6482 fn into_u64(self) -> u64 { 83 self as u64 84 } 85 } 86 87 #[allow(dead_code, reason = "Too lazy to cfg-gate these")] 88 trait IntoU128 { into_u128(self) -> u12889 fn into_u128(self) -> u128; 90 } 91 92 impl IntoU128 for u64 { into_u128(self) -> u12893 fn into_u128(self) -> u128 { 94 u128::from(self) 95 } 96 } 97