add packet clone

This commit is contained in:
Vinzenz Schroeter 2024-08-29 22:21:21 +02:00
parent c9c51dcdc2
commit d385d8e1d4
7 changed files with 87 additions and 31 deletions

View file

@ -8,14 +8,14 @@ use crate::{
};
/// A raw header. Should probably not be used directly.
#[derive(Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Header(pub u16, pub u16, pub u16, pub u16, pub u16);
/// The raw payload. Should probably not be used directly.
pub type Payload = Vec<u8>;
/// The raw packet. Should probably not be used directly.
#[derive(Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
pub struct Packet(pub Header, pub Payload);
impl From<Packet> for Vec<u8> {