zelda 0.1.1

Zelda is a lightweight application-level network protocol for use in real-time applications.
Documentation
use serde::{Serialize, Deserialize};

pub type Payload = Vec<u8>;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Datagram {
    pub rtt_seq: u16,
    pub rtt_ack: u16,
    /// The difference between when the rtt_remote_seq was received and when the ack is sent, in milliseconds.
    pub rtt_offset: u16,
    pub payload: Payload
}

impl Datagram {
    pub fn new(payload: Payload, rtt_seq: u16, rtt_ack: u16, rtt_offset: u16) -> Self {
        Self {
            rtt_seq,
            rtt_ack,
            rtt_offset,
            payload,
        }
    }
}