[][src]Trait rust_ether::StreamTransfer

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

A stream transfer protocol.

Required methods

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

Connect to stream. Most implments should do two things here:

  1. Connect to the stream.
  2. Make sure the server / other peer is online and active.

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

Try to receive a data packet and remove it from queue.

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

Try to receive a data packet.

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

Send a data packet to the server / other peer.

Loading content...

Implementors

impl<T: PacketTransfer> StreamTransfer for StreamTransferOverlay<T>[src]

Loading content...