byten 0.0.13

A binary codec library for efficient encoding and decoding of data structures
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use byten::{Decoder, EncoderToVec as _, byten};

fn main() {
    let codec = byten!( $bytes[u32 $be] $utf8 );

    let original_str = "Hello, Byten!";
    let encoded = codec.encode_to_vec(original_str).unwrap();
    println!("Encoded bytes: {:?}", encoded);

    let decoded_str = codec.decode(&encoded, &mut 0).unwrap();
    println!("Decoded string: {}", decoded_str);
}