bytes_kman/
lib.rs

1#[cfg(feature = "core")]
2pub mod core;
3
4#[cfg(feature = "std")]
5pub mod std;
6
7pub type TBuffer<'a> = Vec<u8>;
8
9pub trait TBytes {
10    fn size(&self) -> usize;
11
12    fn to_bytes(&self) -> Vec<u8>;
13
14    fn from_bytes(buffer: &mut TBuffer) -> Option<Self>
15    where
16        Self: Sized;
17
18    fn from_bytes_ref(buffer: &[u8]) -> Option<Self>
19    where
20        Self: Sized,
21    {
22        let mut buffer = buffer.to_vec();
23        Self::from_bytes(&mut buffer)
24    }
25}
26
27pub extern crate bytes_kman_derive;
28pub use bytes_kman_derive::Bytes;
29
30pub mod prelude {
31    pub use super::Bytes;
32    pub use super::TBuffer;
33    pub use super::TBytes;
34}