Skip to main content

noxu_bind/
lib.rs

1#![forbid(unsafe_code)]
2// Copyright (C) 2024-2025 Greg Burd.  Licensed under either of the
3// Apache License, Version 2.0 or the MIT license, at your option.
4// See LICENSE-APACHE and LICENSE-MIT at the root of this repository.
5// SPDX-License-Identifier: Apache-2.0 OR MIT
6#![allow(dead_code, clippy::type_complexity, clippy::too_many_arguments)]
7//! Serialization bindings for Noxu DB.
8//!
9//! bindings between database entries
10//! and Rust types, including tuple and byte encoding.
11//!
12//! # Overview
13//!
14//! This crate provides the serialization layer for Noxu DB, converting between
15//! Rust types and `DatabaseEntry` byte representations. The primary mechanism
16//! is the **tuple binding** subsystem, which encodes primitive types into
17//! sortable byte arrays suitable for database keys.
18//!
19//! # Modules
20//!
21//! - [`error`]  -  Error types for binding operations.
22//! - [`entry_binding`]  -  Core `EntryBinding` and `EntityBinding` traits.
23//! - [`byte_array_binding`]  -  Pass-through binding for raw byte arrays.
24//! - [`record_number_binding`]  -  Big-endian u64 record number binding.
25//! - [`tuple`][mod@tuple]  -  Tuple (compact binary) bindings for sortable keys.
26
27pub mod byte_array_binding;
28pub mod entry_binding;
29pub mod error;
30pub mod record_number_binding;
31pub mod serial;
32pub mod tuple;
33
34// Re-export primary types at crate root for convenience.
35pub use byte_array_binding::ByteArrayBinding;
36pub use entry_binding::{EntityBinding, EntryBinding};
37pub use error::{BindError, Result};
38pub use record_number_binding::RecordNumberBinding;
39pub use serial::serde_binding::SerdeBinding;
40pub use serial::tuple_serde_binding::{
41    TupleSerdeBinding, TupleSerdeKeyDataBinding,
42};
43pub use tuple::primitive_bindings::{
44    BoolBinding, ByteBinding, CharBinding, DoubleBinding, FloatBinding,
45    IntBinding, LongBinding, PackedIntBinding, PackedLongBinding, ShortBinding,
46    SortedDoubleBinding, SortedFloatBinding, SortedPackedIntBinding,
47    SortedPackedLongBinding, StringBinding,
48};
49pub use tuple::{SortKey, TupleBinding, TupleInput, TupleOutput};