Thanks to visit codestin.com
Credit goes to lib.rs

7 releases (1 stable)

Uses new Rust 2024

1.0.0 Sep 23, 2025
1.0.0-alpha.7 Sep 12, 2025
1.0.0-alpha.3 Jun 20, 2025

#813 in Encoding

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

402 downloads per month

MIT license

145KB
3.5K SLoC

Serde BEVE

A Serde data format for BEVE.

16-bit floats

BEVE supports both f16s and brain floats. This crate supports the deserialization of both, converting them into f32s. However, similar to extension types, Serde provides no means of serializing these types, and as such their deserialization is gated by the half feature, which enables the use of the half crate for working with them.

Notes

Since BEVE is a binary format, this crate doesn't provide any tools for serializing to or deserializing from strings.

BEVE collections (arrays, object, and strings) store their lengths as compressed integers^1. The compression method uses the first two bits to indicate the number of bytes in the integer, and as such, the maximum size is 62 bits[^2]. If, for some reason, you have a string with more than that many bytes, an array with more than that many items, or (heaven forbid) a struct or map with more than that many fields, serialization will fail.

BEVE is a little-endian format, and for the sake of simplicity, this crate assumes it is being used on a little-endian system.

[^2]: (2^62) - 1 = 4611686018427387904

Dependencies

~0.3–1.1MB
~24K SLoC