Crates.io | tld_msg |
lib.rs | tld_msg |
version | 0.1.0 |
source | src |
created_at | 2021-11-27 16:59:41.368293 |
updated_at | 2021-11-27 16:59:41.368293 |
description | A library for a dead-simple messaging protocol. |
homepage | https://files.almaember.com/tld-messages.txt |
repository | |
max_upload_size | |
id | 488477 |
size | 5,130 |
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());
}