Struct string_telephone::packet::Packet [-]  [+] [src]

pub struct Packet {
    pub protocol_id: u32,
    pub sequence_id: u16,
    pub packet_type: PacketType,
    pub packet_content: Option<Vec<u8>>,
}

The underlying shape for transferring data.

Fields

protocol_id
sequence_id

The current id of the packet

packet_type
packet_content

Serialized user data goes in here

Methods

impl Packet

fn connect(protocol_id: u32, sequence_id: u16) -> Packet

fn disconnect(protocol_id: u32, sequence_id: u16) -> Packet

fn accept(protocol_id: u32, sequence_id: u16) -> Packet

fn reject(protocol_id: u32, sequence_id: u16) -> Packet

fn message(protocol_id: u32, sequence_id: u16, message: Vec<u8>) -> Packet

fn deserialize(raw: &[u8]) -> IoResult<Packet>

fn serialize(&self) -> IoResult<Vec<u8>>

Trait Implementations

Derived Implementations

impl Clone for Packet

fn clone(&self) -> Packet

fn clone_from(&mut self, source: &Self)