stdto_core 0.4.0

Stdto provides a set of functional traits for conversion between various data representations.
Documentation

Stdto

stdto provides a set of functional traits for conversion between various data representations.

CI Crates.io Licensed Twitter

| Examples | Docs | Latest Note |

stdto = "0.4.0"

How to

use stdto::prelude::*;

// #[stdto::bytes(endian = "little")]
#[stdto::bytes]
struct Test {
    a: u32,
    b: String,
    c: [u8; 32],
    d: Vec<u8>,
    e: HashMap<u8, f64>,
}

bytes = test.to_bytes();
Test::from_bytes(&bytes);
#[stdto::bytes]
#[stdto::hash]
struct Test {
    ...
}

test.to_hash::<Sha256>();
// AsRef<u8> to hex

hex = bytes.to_hex();
Vec::<u8>::from_hex(hex);

let mut arr = [0u8; 32];
arr.copy_from_hex(hex);