Expand description
BEVE - Binary Efficient Versatile Encoding
High-performance, tagged binary format designed for scientific computing. This crate provides a robust, fast, and ergonomic implementation with serde support.
- Little-endian encoding
- Direct struct serialization via
serde::{Serialize, Deserialize} - Typed arrays for numeric, boolean, and string sequences when possible
- Object keys as strings or integer types
- Enum support via BEVE type-tag extension
- Validation helpers for checking BEVE payload integrity without deserialization
Example
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct Point { x: f64, y: f64 }
let p = Point { x: 1.0, y: -2.0 };
let bytes = beve::to_vec(&p).unwrap();
let p2: Point = beve::from_slice(&bytes).unwrap();
assert_eq!(p, p2);Validate a payload without decoding it into a concrete Rust type:
use std::io::Cursor;
let bytes = beve::to_vec(&vec![1u32, 2, 3]).unwrap();
beve::validate_slice(&bytes).unwrap();
beve::validate_reader(Cursor::new(bytes)).unwrap();Re-exports§
pub use crate::fast::to_vec_bool_slice;pub use crate::fast::to_vec_complex32;pub use crate::fast::to_vec_complex32_slice;pub use crate::fast::to_vec_complex64;pub use crate::fast::to_vec_complex64_slice;pub use crate::fast::to_vec_str_slice;pub use crate::fast::to_vec_string_slice;pub use crate::fast::to_vec_typed_slice;pub use crate::fast::write_bool_slice;pub use crate::fast::write_str_slice;pub use crate::fast::write_string_slice;pub use crate::fast::write_typed_slice;pub use crate::fast::BeveTypedSlice;
Modules§
Structs§
Enums§
- BigInt
- Large integer that doesn’t fit in 64 bits.
- BigInt
Key - Large integer key that doesn’t fit in 64 bits.
- Decoded
Matrix - Enum
Encoding - Error
- Key
- A map key that can be a string or integer.
- Matrix
Decode Mode - Matrix
Layout - Number
- A BEVE number, which can be signed, unsigned, or floating-point.
- Value
- Represents any valid BEVE value.
- Value
Error - Error type for Value deserialization.
Functions§
- beve_
slice_ to_ json - Convert BEVE bytes into compact JSON bytes.
- beve_
slice_ to_ json_ string - Convert BEVE bytes into a JSON string.
- decode_
matrix_ slice - from_
reader - Deserialize a value by reading all bytes from a reader into a buffer first.
- from_
slice - from_
value - Deserialize a concrete type from a
Value. - from_
value_ ref - Deserialize a concrete type from a
Valuereference. - json_
slice_ to_ beve - Convert JSON bytes into BEVE bytes without building an intermediate DOM.
- json_
str_ to_ beve - Convert a JSON string into BEVE bytes without building an intermediate DOM.
- to_vec
- to_
vec_ into - to_
vec_ into_ with_ options - to_
vec_ with_ options - to_
writer - Serialize a value to any writer. For unknown-length containers, this uses an internal buffer.
- to_
writer_ with_ options - Serialize a value to any writer with custom options.
- validate_
reader - Validate BEVE data from any reader without deserializing into a concrete type.
- validate_
slice - Validate that
bytescontains exactly one well-formed BEVE value.