[−][src]Crate tobytcp
tobytcp
is a library used when sending messages over a buffer, typically an async TcpStream
.
It uses length-prefixing to allow the receiver to differentiate different messages
Examples
Here is a tiny example of what it looks like to use TobyTcp
's built-in send
and receive
fns. Also look at the /examples
directory
and unit tests in the source code for concrete uses of this library.
#![feature(async_await)] let mut buf = vec![1, 2, 3]; send(&mut buf, &mut stream).await?; // Pretend we're connected to an echo server.. let received = receive(&mut stream).await?; assert_eq!(buf, received);
Modules
protocol | Includes methods for generating the |
Functions
receive | Wait for data, which was encoded as |
send | Writes the data, encoded as |