1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pub mod constant;
pub mod frame;
pub mod identifier;
pub mod j1939;
pub mod device;
#[cfg(feature = "isotp-rs")]
pub mod isotp;

pub trait Conversion
where
    Self: Sized,
{
    type Type;

    /// Convert an integer of type [`Self::Type`] into [`Self`]
    fn from_bits(bits: Self::Type) -> Self;

    /// Convert a hexadecimal string slice into [`Self`]
    fn from_hex(hex_str: &str) -> Self;

    /// Convert an integer of type [`Self::Type`] into [`Self`]
    fn try_from_bits(bits: Self::Type) -> Option<Self>;

    /// Convert a hexadecimal string slice into [`Self`]
    fn try_from_hex(hex_str: &str) -> Option<Self>;

    /// Convert `self` into an integer of type [`Self::Type`]
    fn into_bits(self) -> Self::Type;

    /// Convert `self` into a hexadecimal string
    fn into_hex(self) -> String;
}