1use super::*;
2use core::{
3 fmt::{Debug, Display},
4 hash::Hash,
5};
6use num::{
7 traits::{
8 ConstOne, ConstZero, FromBytes, NumAssign, NumAssignRef, NumOps, NumRef, SaturatingAdd,
9 SaturatingMul, SaturatingSub, ToBytes, ToPrimitive,
10 },
11 PrimInt,
12};
13
14#[cfg(feature = "zeroize")]
15pub trait PrimitiveZeroize: zeroize::DefaultIsZeroes {}
17#[cfg(not(feature = "zeroize"))]
18pub trait PrimitiveZeroize {}
20
21#[cfg(feature = "zeroize")]
22impl<T: zeroize::DefaultIsZeroes> PrimitiveZeroize for T {}
23#[cfg(not(feature = "zeroize"))]
24impl<T> PrimitiveZeroize for T {}
25
26pub trait Primitive<const BYTES: usize>:
28 Sized
29 + PrimInt
30 + NumOps
31 + NumRef
32 + NumAssignRef
33 + NumAssign
34 + SaturatingAdd
35 + SaturatingSub
36 + SaturatingMul
37 + ConstOne
38 + ConstZero
39 + FixedArray<BYTES>
40 + ToBytes
41 + FromBytes<Bytes = <Self as ToBytes>::Bytes>
42 + ToPrimitive
43 + Copy
44 + Clone
45 + Default
46 + Debug
47 + Display
48 + 'static
49 + Hash
50 + PrimitiveZeroize
51{
52}
53
54impl<
55 P: Sized
56 + PrimInt
57 + NumOps
58 + NumRef
59 + NumAssignRef
60 + NumAssign
61 + SaturatingAdd
62 + SaturatingSub
63 + SaturatingMul
64 + ConstOne
65 + ConstZero
66 + FixedArray<BYTES>
67 + ToBytes
68 + FromBytes<Bytes = <Self as ToBytes>::Bytes>
69 + ToPrimitive
70 + Copy
71 + Clone
72 + Default
73 + Debug
74 + Display
75 + 'static
76 + Hash
77 + PrimitiveZeroize,
78 const BYTES: usize,
79 > Primitive<BYTES> for P
80{
81}