glorious sans-io tests

This commit is contained in:
nora 2024-08-15 15:45:16 +02:00
parent d68caf8e3c
commit 8c1f3afd89
3 changed files with 107 additions and 12 deletions

View file

@ -148,6 +148,10 @@ pub struct Packet {
impl Packet {
pub const DEFAULT_BLOCK_SIZE: u8 = 8;
pub fn packet_type(&self) -> u8 {
self.payload[0]
}
pub(crate) fn from_full(bytes: &[u8]) -> Result<Self> {
let Some(padding_length) = bytes.first() else {
return Err(client_error!("empty packet"));