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//! > **Internal component of the [`noxu`](https://crates.io/crates/noxu) database.**
8//! >
9//! > This crate is published only so the `noxu` umbrella crate can depend on it.
10//! > Use `noxu` (`noxu = "3"`) in applications; depend on this crate directly only
11//! > if you are extending the engine internals. Its API may change without a major
12//! > version bump.
13//!
14//! Serialization bindings for Noxu DB.
15//!
16//! bindings between database entries
17//! and Rust types, including tuple and byte encoding.
18//!
19//! # Overview
20//!
21//! This crate provides the serialization layer for Noxu DB, converting between
22//! Rust types and `DatabaseEntry` byte representations. The primary mechanism
23//! is the **tuple binding** subsystem, which encodes primitive types into
24//! sortable byte arrays suitable for database keys.
25//!
26//! # Modules
27//!
28//! - [`error`]  -  Error types for binding operations.
29//! - [`entry_binding`]  -  Core `EntryBinding` and `EntityBinding` traits.
30//! - [`byte_array_binding`]  -  Pass-through binding for raw byte arrays.
31//! - [`record_number_binding`]  -  Big-endian u64 record number binding.
32//! - [`tuple`][mod@tuple]  -  Tuple (compact binary) bindings for sortable keys.
33
34pub mod byte_array_binding;
35pub mod entry_binding;
36pub mod error;
37pub mod record_number_binding;
38pub mod serial;
39pub mod tuple;
40
41// Re-export primary types at crate root for convenience.
42pub use byte_array_binding::ByteArrayBinding;
43pub use entry_binding::{EntityBinding, EntryBinding};
44pub use error::{BindError, Result};
45pub use record_number_binding::RecordNumberBinding;
46pub use serial::serde_binding::SerdeBinding;
47pub use serial::tuple_serde_binding::{
48    TupleSerdeBinding, TupleSerdeKeyDataBinding,
49};
50pub use tuple::primitive_bindings::{
51    BoolBinding, ByteBinding, CharBinding, DoubleBinding, FloatBinding,
52    IntBinding, LongBinding, PackedIntBinding, PackedLongBinding, ShortBinding,
53    SortedDoubleBinding, SortedFloatBinding, SortedPackedIntBinding,
54    SortedPackedLongBinding, StringBinding,
55};
56pub use tuple::{SortKey, TupleBinding, TupleInput, TupleOutput};