chaud_hot/util/into.rs
1/// Like [`Into`], but posisbly cfg-dependent.
2pub trait CfgInto<T> {
3 fn cfg_into(self) -> T;
4}
5
6#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
7impl CfgInto<usize> for u32 {
8 #[expect(clippy::expect_used, reason = "`cfg` ensures this is unreachable")]
9 #[inline]
10 fn cfg_into(self) -> usize {
11 self.try_into().expect("unreachable")
12 }
13}