pub mod api;
pub mod builder;
pub mod cache;
pub mod footer;
pub mod format;
pub mod header;
pub mod machine_types;
pub mod rkyv_compat;
#[cfg(feature = "serde-compat")]
pub mod serde_compat;
pub mod simd;
pub mod slot;
pub mod traits;
pub mod types;
#[cfg(feature = "arena")]
pub mod arena;
pub mod optimized_rkyv;
pub mod blocking;
pub mod compress;
pub mod intern;
#[cfg(feature = "mmap")]
pub mod mmap;
#[cfg(feature = "mmap")]
pub mod quantum;
pub trait AsyncFileIO: Send + Sync {
fn read_sync(&self, path: &std::path::Path) -> std::io::Result<Vec<u8>>;
fn write_sync(&self, path: &std::path::Path, data: &[u8]) -> std::io::Result<()>;
fn read_batch_sync(
&self,
paths: &[&std::path::Path],
) -> std::io::Result<Vec<std::io::Result<Vec<u8>>>>;
fn write_batch_sync(
&self,
files: &[(&std::path::Path, &[u8])],
) -> std::io::Result<Vec<std::io::Result<()>>>;
fn backend_name(&self) -> &'static str;
fn is_available(&self) -> bool;
}
pub use api::{deserialize, deserialize_batch, serialize, serialize_batch};
pub use builder::DxMachineBuilder;
pub use cache::{
MACHINE_CACHE_HEADER_LEN, MachineCacheCodec, MachineCacheError, MachineCacheKind,
MachineCacheMiss, MachineCachePaths, MachineCacheReceipt, MachineCacheSchema,
MachineCacheSource, MachineCacheWriteOptions, access_typed_machine_cache,
paths_for_project_cache, source_fingerprint, write_typed_machine_cache,
};
#[cfg(feature = "mmap")]
pub use cache::{MappedMachineCache, open_typed_machine_cache};
#[cfg(feature = "converters")]
pub use cache::{json_source_to_typed_machine_cache, toml_source_to_typed_machine_cache};
pub use format::{DxFormat, FormatMode, detect_format, parse_auto};
pub use header::{
DxMachineHeader, FLAG_HAS_HEAP, FLAG_HAS_INTERN, FLAG_HAS_LENGTH_TABLE, FLAG_LITTLE_ENDIAN,
};
#[cfg(feature = "serde-compat")]
pub use serde_compat::{from_bytes as from_bytes_serde, to_bytes as to_bytes_serde};
pub use slot::{DxMachineSlot, HEAP_MARKER, INLINE_MARKER, MAX_INLINE_SIZE};
pub use traits::{DxMachineDeserialize, DxMachineSerialize};
pub use types::DxMachineError;
#[cfg(feature = "arena")]
pub use optimized_rkyv::ArenaRkyv;
#[cfg(feature = "compression")]
pub use optimized_rkyv::CompressedRkyv;
#[cfg(feature = "mmap")]
pub use optimized_rkyv::MmapRkyv;
pub use optimized_rkyv::OptimizedRkyv;
pub use compress::{CompressionLevel, DxCompressed};
pub use intern::{InternError, InternPool, InterningDeserializer, InterningSerializer};
#[cfg(feature = "mmap")]
pub use mmap::{DxMmap, DxMmapBatch};
pub const MAGIC: [u8; 2] = [0x5A, 0x44];
pub const VERSION: u8 = 0x01;
pub const SLOT_SIZE: usize = 16;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_magic_bytes() {
assert_eq!(MAGIC, [0x5A, 0x44]);
assert_eq!(VERSION, 0x01);
}
#[test]
fn test_slot_size() {
assert_eq!(SLOT_SIZE, 16);
assert_eq!(MAX_INLINE_SIZE, 14);
}
}