Skip to main content

Crate beve

Crate beve 

Source
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§

fast
util
BEVE-specific utilities and helper types.

Structs§

Complex
ComplexSlice
Deserializer
Matrix
MatrixOwned
RawMatrix
Serializer
SerializerOptions

Enums§

BigInt
Large integer that doesn’t fit in 64 bits.
BigIntKey
Large integer key that doesn’t fit in 64 bits.
DecodedMatrix
EnumEncoding
Error
Key
A map key that can be a string or integer.
MatrixDecodeMode
MatrixLayout
Number
A BEVE number, which can be signed, unsigned, or floating-point.
Value
Represents any valid BEVE value.
ValueError
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 Value reference.
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 bytes contains exactly one well-formed BEVE value.

Type Aliases§

Object
A BEVE object with ordered key-value pairs.
Result