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
#[cfg(not(feature = "std"))]
use alloc::borrow::Cow;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
use crate::error::Error;
pub trait FromBytes: Len {
type E: Error;
fn from_bytes(bytes: &[u8]) -> Result<Self, Self::E>
where
Self: Sized;
}
pub trait ToVec: Len {
fn to_vec(&self) -> Vec<u8>
where
Self: Sized;
}
pub trait Len {
const LEN: usize;
}