1#[deprecated(note = "Use primint::UnsignedPrimInt directly")]
20pub trait UnsignedPrimInt: primint::UnsignedPrimInt {}
21#[allow(deprecated)]
22impl<T: primint::UnsignedPrimInt> UnsignedPrimInt for T {}
23
24#[deprecated(note = "Use primint::fmt::DebugDesc directly")]
33pub type DebugDesc<T> = primint::fmt::DebugDesc<T>;
34
35macro_rules! deprecated_shim_fn {
36 (@add_attrs $name:ident => $target:path {$decl:item}) => {
37 #[doc = concat!("An alias for [`", stringify!($target), "`].")]
38 #[deprecated = concat!("Use ", stringify!($target), " directly.")]
46 #[inline] #[allow(deprecated)]
48 $decl
49 };
50 (@determine_target $name:ident $target:path) => ($target);
51 (@determine_target $name:ident) => (primint::$name);
52 ($($({$x:ident})? fn $name:ident $(<$($param:ident: $bound:ident),+>)? ($($arg:ident: $argty:ty),*) $(-> $ret:ty)?;)+) => {
53 $(deprecated_shim_fn!(@add_attrs $name => primint::$name {
54 pub $($x)? fn $name$(<$($param: $bound),*>)?($($arg: $argty,)*) $(-> $ret)? {
55 primint::$name $(::<$($param, )*>)?($($arg),*)
56 }
57 });)*
58 };
59}
60deprecated_shim_fn! {
61 {const} fn bits<T: UnsignedPrimInt>() -> u32;
62 fn checked_add<T: UnsignedPrimInt>(left: T, right: T) -> Option<T>;
63 fn checked_cast<T: UnsignedPrimInt, U: UnsignedPrimInt>(value: T) -> Option<U>;
64 fn checked_sub<T: UnsignedPrimInt>(left: T, right: T) -> Option<T>;
65 fn count_ones<T: UnsignedPrimInt>(value: T) -> u32;
66 fn from_usize_checked<T: UnsignedPrimInt>(value: usize) -> Option<T>;
67 fn from_usize_wrapping<T: UnsignedPrimInt>(value: usize) -> T;
68 fn leading_zeros<T: UnsignedPrimInt>(value: T) -> u32;
69 {const} fn max_value<T: UnsignedPrimInt>() -> T;
70 {const} fn one<T: UnsignedPrimInt>() -> T;
71 fn to_usize_checked<T: UnsignedPrimInt>(value: T) -> Option<usize>;
72 fn to_usize_wrapping<T: UnsignedPrimInt>(value: T) -> usize;
73 fn trailing_zeros<T: UnsignedPrimInt>(value: T) -> u32;
74 {const} fn zero<T: UnsignedPrimInt>() -> T;
75}
76deprecated_shim_fn! {
77 @add_attrs debug_desc => primint::fmt::debug_desc {
78 pub fn debug_desc<T: UnsignedPrimInt>(value: T) -> DebugDesc<T> {
79 primint::fmt::debug_desc(value)
80 }
81 }
82}
83
84#[inline(never)]
90#[track_caller]
91#[cold]
92pub(crate) fn invalid_id<T: primint::UnsignedPrimInt>(id: T) -> ! {
93 panic!("Invalid id: {}", primint::fmt::debug_desc(id))
94}