mathypad/
lib.rs

1//! # Mathypad
2//!
3//! A smart calculator that understands units and makes complex calculations simple.
4//!
5//! This library provides the core functionality for mathypad, including:
6//! - Unit-aware mathematical expression evaluation
7//! - Comprehensive unit conversion system
8//! - TUI application framework
9//! - CLI interface utilities
10
11pub mod cli;
12pub mod version;
13
14// TUI-related modules (not available on WASM)
15#[cfg(not(target_arch = "wasm32"))]
16pub mod app;
17#[cfg(not(target_arch = "wasm32"))]
18pub mod mode;
19#[cfg(not(target_arch = "wasm32"))]
20pub mod ui;
21
22// GUI module (only available with 'gui' feature)
23#[cfg(feature = "gui")]
24pub mod gui;
25
26// Re-export core functionality
27pub use mathypad_core::{expression, units};
28
29#[cfg(test)]
30mod integration_tests;
31
32// Re-export commonly used types for convenience
33pub use cli::run_one_shot_mode;
34pub use mathypad_core::expression::evaluator::evaluate_expression_with_context;
35pub use mathypad_core::{Unit, UnitType, UnitValue};
36
37// TUI-related re-exports (not available on WASM)
38#[cfg(not(target_arch = "wasm32"))]
39pub use app::App;
40#[cfg(not(target_arch = "wasm32"))]
41pub use mode::Mode;
42#[cfg(not(target_arch = "wasm32"))]
43pub use ui::{run_interactive_mode, run_interactive_mode_with_file};
44
45// TUI constants (not needed on WASM)
46#[cfg(not(target_arch = "wasm32"))]
47pub const TICK_RATE_MS: u64 = 16; // ~60 FPS for smooth animations
48
49// Re-export constants from core
50pub use mathypad_core::{FLOAT_EPSILON, MAX_INTEGER_FOR_FORMATTING};
51
52// Re-export test helpers from core to avoid duplication
53#[cfg(test)]
54pub use mathypad_core::test_helpers;
55
56// WASM entry point (only for wasm32 target with gui feature)
57#[cfg(all(feature = "gui", target_arch = "wasm32"))]
58pub use gui::wasm::main;