pub trait StreamTransfer {
// Required methods
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>;
}
Expand description
A stream transfer protocol.
Required Methods§
Sourcefn connect(&mut self) -> Result<(), String>
fn connect(&mut self) -> Result<(), String>
Connect to stream. Most implments should do two things here:
Connect
to the stream.- Make sure the server / other peer is online and active.