dx_forge/lib.rs
1//! # Forge - Ultra-Fast File Watcher Library
2//!
3//! Production-ready file watcher with dual-mode event system optimized for DX tools.
4//!
5//! ## Features
6//!
7//! - **Rapid Events** (<35µs): Ultra-fast change notifications for immediate UI feedback
8//! - **Quality Events** (<60µs): Complete operation details with line numbers and diffs
9//! - **Zero Environment Variables**: Production-ready with optimal hardcoded settings
10//! - **CRDT-based**: Conflict-free replicated data types for distributed sync
11//! - **Memory-mapped I/O**: Leverages OS page cache for sub-microsecond reads
12//!
13//! ## Quick Start
14//!
15//! ```rust,no_run
16//! use forge::{ForgeWatcher, ForgeEvent};
17//!
18//! #[tokio::main]
19//! async fn main() -> anyhow::Result<()> {
20//! let watcher = ForgeWatcher::new(".", |event| {
21//! match event {
22//! ForgeEvent::Rapid { path, time_us } => {
23//! println!("⚡ File changed: {} ({}µs)", path, time_us);
24//! }
25//! ForgeEvent::Quality { path, operations, time_us, .. } => {
26//! println!("📊 {} operations in {} ({}µs)", operations.len(), path, time_us);
27//! }
28//! }
29//! }).await?;
30//!
31//! watcher.run().await?;
32//! Ok(())
33//! }
34//! ```
35
36pub mod context;
37pub mod crdt;
38pub mod server;
39pub mod storage;
40pub mod sync;
41pub mod watcher;
42
43// Re-export main types for library consumers
44pub use crdt::{Operation, OperationType, Position};
45pub use watcher::{ForgeEvent, ForgeWatcher, RapidChange, QualityChange};
46pub use storage::{Database, OperationLog};
47
48/// Library version
49pub const VERSION: &str = env!("CARGO_PKG_VERSION");