Stdto
stdto
provides a set of functional traits for conversion between various data representations.
| Examples | Docs | Latest Note |
= "0.7.0"
Goal
As a blockchain developer who specializes in Rust, I often find it challenging to work with bytes, hashes, and JSON. The Rust ecosystem is decentralized and many popular crates are old and complex. This makes it difficult to find simple, well-abstracted solutions that are easy to understand. I created the Stdto crate to address this need. The goal of Stdto is to provide a standard library-like interface that makes it easy for users to work with and understand primitive data structures.
Features
= ["derive", "serde", "bytes", "hash", "json", "hex"]
Examples
use *;
// #[stdto::bytes(endian = "little")]
bytes = test.to_bytes;
from_bytes;
= test.;
hash
= test.to_json;
from_json;
json
// AsRef<[u8]> to hex
hex = hash.to_hex;
Vec:: from_hex;
mut arr = ;
arr.copy_from_hex;
// AsRef<[u8]> <-> String, &str
arr = ;
s1 = arr.into_string;
bytes = s1.to_bytes;
s2 = bytes.as_str;
assert_eq!;