[][src]Trait rust_ether::PacketTransfer

pub trait PacketTransfer {
    fn connect(&mut self) -> Result<(), String>;
fn peek(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String>;
fn send(&mut self, tag: &str, data: Vec<u8>) -> Result<(), String>;
fn remove(&mut self, tag: &str) -> Result<(), String>; fn recv(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String> { ... } }

A packet transfer protocol. It is similear to StreamTransfer trait but provides a tag for transfer index.

Required methods

fn connect(&mut self) -> Result<(), String>

Connect to host. Most implments should make sure the server / other peer is avaliable.

fn peek(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String>

Try to receive a data packet.

fn send(&mut self, tag: &str, data: Vec<u8>) -> Result<(), String>

Try to send a data packet to the server / other peer.

fn remove(&mut self, tag: &str) -> Result<(), String>

Remove the packet from the queue.

Loading content...

Provided methods

fn recv(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String>

Try to receive a data packet and remove it.

Loading content...

Implementors

impl<T: DataStorage> PacketTransfer for T[src]

Loading content...