implemented function to get timestamp from bytes

This commit is contained in:
2022-07-28 11:38:32 +02:00
parent 88af155490
commit 4fc281070f
3 changed files with 131 additions and 37 deletions

@ -13,10 +13,17 @@ pub mod tc;
pub mod time;
pub mod tm;
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct SizeMissmatch {
found: usize,
expected: usize,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum PacketError {
/// The passed slice is too small. Returns the required size of the failed size check
ToBytesSliceTooSmall(usize),
/// The passed slice is too small. Returns the found and expected minimum size
ToBytesSliceTooSmall(SizeMissmatch),
/// The provider buffer it soo small. Returns the found and expected minimum size
FromBytesSliceTooSmall(SizeMissmatch),
/// The [zerocopy] library failed to write to bytes
ToBytesZeroCopyError,
FromBytesZeroCopyError,