Struct string_telephone::shared::ConnectionConfig [-]  [+] [src]

pub struct ConnectionConfig<T> {
    pub protocol_id: u32,
    pub timeout_period: Duration,
    pub packet_deserializer: fn(&Vec<u8>) -> Option<T>,
    pub packet_serializer: fn(&T) -> Vec<u8>,
}

General configuration for a connection

Fields

protocol_id

A shared ID to identify whether a connection should be accepted

timeout_period

How long we should wait before hanging up

packet_deserializer

A function to turn raw data into our packet format

packet_serializer

A function to turn a packet into raw data

Methods

impl<T> ConnectionConfig<T>

fn new(protocol_id: u32, timeout_period: Duration, packet_deserializer: fn(&Vec<u8>) -> Option<T>, packet_serializer: fn(&T) -> Vec<u8>) -> ConnectionConfig<T>

Create a new ConnectionConfig object