1#![doc = include_str!("../README.md")]
2#![cfg_attr(feature = "marker_trait_attr", feature(marker_trait_attr))]
3#![cfg_attr(feature = "never_type", feature(never_type))]
4#![cfg_attr(docsrs, feature(doc_cfg))]
5#![no_std]
6
7pub use {prim_signed_int::PrimSignedInt, prim_unsigned_int::PrimUnsignedInt};
8
9#[cfg_attr(feature = "marker_trait_attr", marker)]
12pub trait PrimInt: PrimNum {}
13
14#[cfg(not(feature = "marker_trait_attr"))]
15mod prim_int_impl {
16 impl super::PrimInt for u8 {}
17 impl super::PrimInt for u16 {}
18 impl super::PrimInt for u32 {}
19 impl super::PrimInt for u64 {}
20 impl super::PrimInt for u128 {}
21 impl super::PrimInt for usize {}
22
23 impl super::PrimInt for i8 {}
24 impl super::PrimInt for i16 {}
25 impl super::PrimInt for i32 {}
26 impl super::PrimInt for i64 {}
27 impl super::PrimInt for i128 {}
28 impl super::PrimInt for isize {}
29}
30
31#[cfg(feature = "marker_trait_attr")]
32mod prim_int_impl {
33 impl<T: super::PrimUnsignedInt> super::PrimInt for T {}
34 impl<T: super::PrimSignedInt> super::PrimInt for T {}
35}
36
37mod prim_unsigned_int {
38 #[cfg_attr(feature = "marker_trait_attr", marker)]
41 pub trait PrimUnsignedInt: super::PrimInt {}
42
43 impl PrimUnsignedInt for u8 {}
44 impl PrimUnsignedInt for u16 {}
45 impl PrimUnsignedInt for u32 {}
46 impl PrimUnsignedInt for u64 {}
47 impl PrimUnsignedInt for u128 {}
48 impl PrimUnsignedInt for usize {}
49}
50
51mod prim_signed_int {
52 #[cfg_attr(feature = "marker_trait_attr", marker)]
55 pub trait PrimSignedInt: super::PrimInt {}
56
57 impl PrimSignedInt for i8 {}
58 impl PrimSignedInt for i16 {}
59 impl PrimSignedInt for i32 {}
60 impl PrimSignedInt for i64 {}
61 impl PrimSignedInt for i128 {}
62 impl PrimSignedInt for isize {}
63}
64
65#[cfg_attr(feature = "marker_trait_attr", marker)]
68pub trait PrimFloat: PrimNum {}
69
70#[cfg(feature = "marker_trait_attr")]
71mod prim_num_impl {
72 impl<T: crate::PrimFloat> crate::PrimNum for T {}
73 impl<T: crate::PrimInt> crate::PrimNum for T {}
74}
75
76mod prim_float_impl {
77 impl crate::PrimFloat for f32 {}
78 impl crate::PrimFloat for f64 {}
79}
80
81#[cfg_attr(feature = "marker_trait_attr", marker)]
84pub trait PrimNum: Prim {}
85
86#[cfg(not(feature = "marker_trait_attr"))]
87mod prim_num_impl {
88 impl crate::PrimNum for u8 {}
89 impl crate::PrimNum for u16 {}
90 impl crate::PrimNum for u32 {}
91 impl crate::PrimNum for u64 {}
92 impl crate::PrimNum for u128 {}
93 impl crate::PrimNum for usize {}
94
95 impl crate::PrimNum for i8 {}
96 impl crate::PrimNum for i16 {}
97 impl crate::PrimNum for i32 {}
98 impl crate::PrimNum for i64 {}
99 impl crate::PrimNum for i128 {}
100 impl crate::PrimNum for isize {}
101
102 impl crate::PrimNum for f32 {}
103 impl crate::PrimNum for f64 {}
104}
105
106#[cfg_attr(feature = "marker_trait_attr", marker)]
109pub trait PrimTextual {}
110
111impl PrimTextual for char {}
112impl PrimTextual for str {}
113
114#[cfg_attr(feature = "marker_trait_attr", marker)]
117pub trait Prim {}
118
119#[cfg(not(feature = "marker_trait_attr"))]
120mod prim_impl {
121 impl crate::Prim for bool {}
122
123 impl crate::Prim for u8 {}
124 impl crate::Prim for u16 {}
125 impl crate::Prim for u32 {}
126 impl crate::Prim for u64 {}
127 impl crate::Prim for u128 {}
128 impl crate::Prim for usize {}
129
130 impl crate::Prim for i8 {}
131 impl crate::Prim for i16 {}
132 impl crate::Prim for i32 {}
133 impl crate::Prim for i64 {}
134 impl crate::Prim for i128 {}
135 impl crate::Prim for isize {}
136
137 impl crate::Prim for f32 {}
138 impl crate::Prim for f64 {}
139
140 impl crate::Prim for char {}
141 impl crate::Prim for str {}
142
143 #[cfg_attr(docsrs, doc(cfg(feature = "never_type")))]
144 #[cfg(feature = "never_type")]
145 impl crate::Prim for ! {}
146}
147
148#[cfg(feature = "marker_trait_attr")]
149mod prim_impl {
150 impl crate::Prim for bool {}
151 impl<T: crate::PrimNum> crate::Prim for T {}
152 impl<T: crate::PrimTextual> crate::Prim for T {}
153
154 #[cfg_attr(docsrs, doc(cfg(feature = "never_type")))]
155 #[cfg(feature = "never_type")]
156 impl crate::Prim for ! {}
157}