1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Serialization module
//!
//! Provides model serialization in multiple formats:
//! - rkyv: Zero-copy deserialization, fastest loading (recommended for production)
//! - bincode: Compact binary format, serde-based
//! - trb: Incremental format supporting model updates and crash recovery
//!
//! # Feature Flags
//!
//! - **`mmap`**: Enables [`MmapTrbReader`] for true zero-copy I/O. When enabled,
//! TRB files can be memory-mapped for instant model loading with lazy page faults.
//!
//! # TRB Reader Comparison
//!
//! | Reader | Feature | I/O Model | Load Time | Memory |
//! |--------|---------|-----------|-----------|--------|
//! | [`TrbReader`] | default | read() to heap | O(model_size) | O(model_size) |
//! | [`MmapTrbReader`] | `mmap` | mmap (lazy) | O(1) | O(1) initial |
//!
//! # Example (with mmap feature)
//!
//! ```ignore
//! #[cfg(feature = "mmap")]
//! {
//! use treeboost::serialize::MmapTrbReader;
//!
//! // Instant load - no heap allocation
//! let reader = MmapTrbReader::open("model.trb")?;
//!
//! // Option 1: Zero-copy access to archived model
//! let archived = reader.archived_model()?;
//!
//! // Option 2: Deserialize (still faster than TrbReader due to mmap)
//! let model = reader.load_model()?;
//! }
//! ```
pub use ;
pub use ;
pub use ;
// Re-export MmapTrbReader when mmap feature is enabled
pub use MmapTrbReader;