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
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate::{Decode, EncodingFormat, SharedData, VariantError};
pub trait SimpleDecode: Decode {
fn slice_data_simple(
data: impl Into<SharedData>,
format: EncodingFormat,
) -> Result<SharedData, VariantError>
where
Self: Sized,
{
Self::slice_data(data, Self::SIGNATURE_STR, format)
}
fn decode_simple(
data: impl Into<SharedData>,
format: EncodingFormat,
) -> Result<Self, VariantError>
where
Self: Sized,
{
Self::decode(data, Self::SIGNATURE_STR, format)
}
}
impl SimpleDecode for u8 {}
impl SimpleDecode for bool {}
impl SimpleDecode for i16 {}
impl SimpleDecode for u16 {}
impl SimpleDecode for i32 {}
impl SimpleDecode for u32 {}
impl SimpleDecode for i64 {}
impl SimpleDecode for u64 {}
impl SimpleDecode for f64 {}