flatdata/
helper.rs

1//! Module which contains internal helper traits.
2
3/// Helper trait which defines a constant for an integer type whether it is signed.
4pub trait Int {
5    /// `true` if the implementing type is signed, otherwise `false`.
6    const IS_SIGNED: bool;
7}
8
9impl Int for bool {
10    const IS_SIGNED: bool = false;
11}
12
13impl Int for i8 {
14    const IS_SIGNED: bool = true;
15}
16
17impl Int for u8 {
18    const IS_SIGNED: bool = false;
19}
20
21impl Int for i16 {
22    const IS_SIGNED: bool = true;
23}
24
25impl Int for u16 {
26    const IS_SIGNED: bool = false;
27}
28
29impl Int for i32 {
30    const IS_SIGNED: bool = true;
31}
32
33impl Int for u32 {
34    const IS_SIGNED: bool = false;
35}
36
37impl Int for i64 {
38    const IS_SIGNED: bool = true;
39}
40
41impl Int for u64 {
42    const IS_SIGNED: bool = false;
43}