1 unstable release

0.1.0 Nov 27, 2021

#5 in #dead-simple

BSD-3-Clause

4KB

tld_msg

This is a simple crate for the TLDMP protocol. There isn't much else to say about it.

It's extremely simplistic. The source code is about 40 lines.

Here's an example, though:

mod lib;

fn main() {
    let mut output: Vec<u8> = Vec::new();

    lib::send(&mut output, 1, &mut "Hey!".as_bytes()).unwrap();
    let mut input = &output[..];
    let msg = lib::receive(&mut input).unwrap();

    println!("{:#?}", output);
    println!("{:#?}\n{}", msg, String::from_utf8(msg.content.clone()).unwrap());
}

lib.rs:

A crate to implement the TLDMP protocol. Example usage:


fn main() {
    let mut output: Vec<u8> = Vec::new();

    tld_msg::send(&mut output, 1, &mut "Hey!".as_bytes()).unwrap();
    let mut input = &output[..];
    let msg = tld_msg::receive(&mut input).unwrap();

    println!("{:#?}", output);
    println!("{:#?}\n{}", msg, String::from_utf8(msg.content.clone()).unwrap());
}

No runtime deps