excelstream/lib.rs
1//! # excelstream
2//!
3//! A high-performance Rust library for streaming Excel import/export operations.
4//!
5//! ## Features
6//!
7//! - **Streaming Read**: Read large Excel files without loading entire file into memory
8//! - **Streaming Write**: Write millions of rows with constant ~80MB memory usage
9//! - **Formula Support**: Write Excel formulas that calculate correctly
10//! - **High Performance**: 30K-45K rows/sec throughput with true streaming
11//! - **Better Errors**: Context-rich error messages with debugging info
12//! - **Multiple Formats**: Support for XLSX, XLS, ODS formats
13//! - **Type Safety**: Strong typing with Rust's type system
14//! - **Zero-copy**: Minimize memory allocations where possible
15//!
16//! ## Quick Start
17//!
18//! ### Reading Excel Files (Streaming)
19//!
20//! ```rust,no_run
21//! use excelstream::reader::ExcelReader;
22//!
23//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
24//! let mut reader = ExcelReader::open("data.xlsx")?;
25//!
26//! for row_result in reader.rows("Sheet1")? {
27//! let row = row_result?;
28//! println!("Row: {:?}", row);
29//! }
30//! # Ok(())
31//! # }
32//! ```
33//!
34//! ### Writing Excel Files (Streaming)
35//!
36//! ```rust,no_run
37//! use excelstream::writer::ExcelWriter;
38//! use excelstream::types::CellValue;
39//!
40//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
41//! let mut writer = ExcelWriter::new("output.xlsx")?;
42//!
43//! // Write header
44//! writer.write_header(&["Name", "Age", "City"])?;
45//!
46//! // Write data rows with typed values
47//! writer.write_row_typed(&[
48//! CellValue::String("Alice".to_string()),
49//! CellValue::Int(30),
50//! CellValue::String("New York".to_string()),
51//! ])?;
52//!
53//! // Write with formulas
54//! writer.write_row_typed(&[
55//! CellValue::String("Total".to_string()),
56//! CellValue::Formula("=COUNT(B2:B10)".to_string()),
57//! CellValue::Empty,
58//! ])?;
59//!
60//! writer.save()?;
61//! # Ok(())
62//! # }
63//! ```
64
65pub mod error;
66pub mod fast_writer;
67pub mod reader;
68pub mod types;
69pub mod writer;
70
71pub use error::{ExcelError, Result};
72pub use reader::ExcelReader;
73pub use types::{Cell, CellStyle, CellValue, Row, StyledCell};
74pub use writer::ExcelWriter;
75
76#[cfg(test)]
77mod tests {
78 use super::*;
79
80 #[test]
81 fn test_library_imports() {
82 // Test that all public types are accessible
83 let _ = std::marker::PhantomData::<ExcelError>;
84 let _ = std::marker::PhantomData::<ExcelReader>;
85 let _ = std::marker::PhantomData::<ExcelWriter>;
86 }
87}