pub trait PacketTransfer {
// Required methods
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>;
// Provided method
fn recv(&mut self, tag: &str) -> Result<Option<Vec<u8>>, String> { ... }
}
Expand description
A packet transfer protocol. It is similear to StreamTransfer
trait but provides a tag
for transfer index.
Required Methods§
Sourcefn connect(&mut self) -> Result<(), String>
fn connect(&mut self) -> Result<(), String>
Connect to host. Most implments should make sure the server / other peer is avaliable.