Expand description
§NanoBit - High-Performance Async Binary Serialization
A fast, efficient, and ergonomic binary serialization library with async support.
§Features
- Zero-copy deserialization where possible
- Async/await support for non-blocking I/O
- High performance with minimal allocations
- Flexible compression with LZ4 support
- Serde compatibility for easy integration
- No unsafe code in the core library
§Quick Start
use nanobit::{to_bytes, from_bytes};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct Person {
name: String,
age: u32,
}
let person = Person {
name: "Alice".to_string(),
age: 30,
};
let bytes = to_bytes(&person)?;
let decoded: Person = from_bytes(&bytes)?;
assert_eq!(person, decoded);Re-exports§
pub use error::Error;pub use error::Result;pub use ser::Serializer;pub use ser::to_bytes;pub use ser::to_writer;pub use de::Deserializer;pub use de::from_bytes;pub use de::from_reader;pub use buffer::WriteBuffer;pub use buffer::ReadBuffer;pub use compression::CompressionFormat;pub use compression::CompressionLevel;pub use compression::compress;pub use compression::decompress;pub use compression::compress_default;pub use compression::is_serialized;
Modules§
- buffer
- High-performance buffer implementations for binary I/O
- compression
- Multi-format compression utilities for nanobit
- de
- Binary deserialization implementation
- error
- Error types for NanoBit serialization
- ser
- Binary serialization implementation
Constants§
- DEFAULT_
BUFFER_ SIZE - Default buffer size for serialization
- MAGIC
- Magic bytes to identify NanoBit format
- VERSION
- Current format version
Functions§
- deserialize
- Deserialize a value from bytes using the default configuration
- deserialize_
compressed - Deserialize compressed data
- serialize
- Serialize a value to bytes using the default configuration
- serialize_
compressed - Serialize with compression