An async i/o chat server prototype written in rust
977f78fa — drbawb a month ago
(repo) update readme to mention linetest crate
3d896ca7 — drbawb a month ago
(repo) Release project under BSD license.
eb9a9fe2 — drbawb a month ago
(ui/buffer): fix panic when using home/end keys


browse  log 



You can also use your local clone with git send-email.


smolboi is a prototype of a chat server written in Rust using async I/O, driven by the smol async runtime. It also contains a sample client, linetest, which is useful for testing & debugging.


  1. Download the rust toolchain for your operating system.
  2. Run cargo build in the root of this workspace to build all crates within the workspace simultaneously.
  3. Run cargo run --bin server to start the server on localhost.
  4. Run cargo run --bin linetest to start the client.


The codec for the chat protocol can be found in smolboi/src/protocol.rs in the protocol::packet module. In general the protocol works as follows:

The first two bytes on the wire(network byte-order) represent the length of the packet to be decoded. This tells a receiver how many bytes to read. The receiver should allocate a buffer of that size and pass the resultant buffer to Packet::decode(...).

NOTE: as a consequence a packet can be no greater than u16::MAX bytes long, e.g: 64KiB total.

It is important to note that this is not a general purpose serialization format, it is a purpose-built binary mapping of the packets enumerated by the protocol::packet::Packet type.

In general packet fields are arranged on the wire in the order they are listed in the enumeration, types will be encoded as follows:

  • bool is encoded as a u8 which is either 0 or 1.

    • NOTE: any other integer value represents a decode error and must be rejected.
  • String is encoded as a length (u16) and then a series of bytes representing a UTF-8 encoded string.

    • NOTE: any other encoding must be rejected by a conforming receiver.
    • NOTE: attempt to encode a string of length greater than u16::MAX is an error and must be rejected by a conforming sender.
  • Integer types will be represented on the wire as bytes in network endian order.

  • Arrays will be encoded similarly to strings: however the u16 length prefix will represent the number of elements in the array. All arrays will be heterogeneous: and contain only the objects described above.

#Terminal Library

The linetest crate contains basic line editing functionality, as well as a scrollable line-oriented buffer. This client is cross-platform, w/ the low-level terminal handling provided by the crossterm crate. Current functionality includes:

  • Line navigation (Home/End, PgUp/PgDown, etc.)
  • Ability to move the cursor (Left, Right)
  • Ability to insert text in the middle of a line
  • Responsive to terminal resize events
  • The span always remains centered around the cursor, even in the face of resize events/cursor mainpulation.