/rust/registry/src/index.crates.io-1949cf8c6b5b557f/twox-hash-2.1.2/src/lib.rs
Line | Count | Source |
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 { |
54 | | fn into_u32(self) -> u32; |
55 | | } |
56 | | |
57 | | impl IntoU32 for u8 { |
58 | 359M | fn into_u32(self) -> u32 { |
59 | 359M | self.into() |
60 | 359M | } |
61 | | } |
62 | | |
63 | | #[allow(dead_code, reason = "Too lazy to cfg-gate these")] |
64 | | trait IntoU64 { |
65 | | fn into_u64(self) -> u64; |
66 | | } |
67 | | |
68 | | impl IntoU64 for u8 { |
69 | 0 | fn into_u64(self) -> u64 { |
70 | 0 | self.into() |
71 | 0 | } |
72 | | } |
73 | | |
74 | | impl IntoU64 for u32 { |
75 | 0 | fn into_u64(self) -> u64 { |
76 | 0 | self.into() |
77 | 0 | } |
78 | | } |
79 | | |
80 | | #[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))] |
81 | | impl IntoU64 for usize { |
82 | 605M | fn into_u64(self) -> u64 { |
83 | 605M | self as u64 |
84 | 605M | } |
85 | | } |
86 | | |
87 | | #[allow(dead_code, reason = "Too lazy to cfg-gate these")] |
88 | | trait IntoU128 { |
89 | | fn into_u128(self) -> u128; |
90 | | } |
91 | | |
92 | | impl IntoU128 for u64 { |
93 | 0 | fn into_u128(self) -> u128 { |
94 | 0 | u128::from(self) |
95 | 0 | } |
96 | | } |