plabble_codec/codec/common/
mod.rs

1/// Plabble dynamic integer
2pub mod dyn_int;
3
4/// Plabble date timestamp
5pub mod plabble_date;
6mod slot_body;
7mod slot_range;
8
9pub use slot_body::SlotBody;
10pub use slot_range::SlotRange;
11
12use crate::abstractions::SerializationError;
13
14/// Assertion method. Asserts that size is the required size and returns an error if not.
15pub(crate) fn assert_len(slice: &[u8], required: usize) -> Result<(), SerializationError> {
16    if slice.len() < required {
17        Err(SerializationError::TooFewBytes(required - slice.len()))
18    } else {
19        Ok(())
20    }
21}