Hex encoding helper for serde

Build Status License: Apache-2.0 rust 1.41.0+ required

Documentation: Docs.rs crate docs (master)

hex-buffer-serde is a helper crate allowing to serialize types, which logically correspond to a byte buffer, in hex encoding within serde.

Usage

Add this to your Crate.toml:

toml [dependencies] hex-buffer-serde = "0.3.0"

Basic usage:

```rust use hexbufferserde::{Hex as , HexForm}; use serdederive::{Deserialize, Serialize};

[derive(Serialize, Deserialize)]

pub struct Example { // will be serialized as hex string in human-readable formats // (e.g., JSON or TOML), and as a byte array in binary formats // (e.g., bincode). #[serde(with = "HexForm")] buffer: [u8; 32], // other fields... } ```

See crate docs for more examples of usage.

Supported Rust Versions

The hex-buffer-serde crate is built against recent stable Rust versions. The minimum of these versions is indicated in the badge at the top of this file. The const_len crate feature requires a newer Rust version (1.51+), but it is disabled by default.

A bump of the minimum supported Rust version will not be considered a semantically breaking change. It is, however, guaranteed that the crate will build on some stable Rust toolchain.

Alternatives

[hex-serde] provides similar functionality and is a viable alternative if you have the control over the type that needs hex-encoding. This crate differs from hex-serde in the following ways:

License

hex-buffer-serde is licensed under the Apache License (Version 2.0). See LICENSE for details.