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 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::streaming_reader::StreamingReader;
22//!
23//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
24//! let mut reader = StreamingReader::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 streaming_reader;
68pub mod types;
69pub mod writer;
70
71// CSV support
72pub mod csv;
73pub mod csv_reader;
74pub mod csv_writer;
75pub mod http_csv_writer;
76
77// Cloud storage integration (optional)
78#[cfg(any(
79 feature = "cloud-s3",
80 feature = "cloud-gcs",
81 feature = "cloud-azure",
82 feature = "cloud-http"
83))]
84pub mod cloud;
85
86// Parquet support (optional)
87#[cfg(feature = "parquet-support")]
88pub mod parquet;
89
90// Incremental append mode
91pub mod append;
92
93pub use error::{ExcelError, Result};
94pub use streaming_reader::StreamingReader as ExcelReader; // Re-export for backward compatibility
95pub use types::{Cell, CellStyle, CellValue, ProtectionOptions, Row, StyledCell};
96pub use writer::ExcelWriter;
97
98// CSV exports
99pub use csv::CompressionMethod;
100pub use csv_reader::CsvReader;
101pub use csv_writer::CsvWriter;
102pub use http_csv_writer::HttpCsvWriter;
103
104#[cfg(test)]
105mod tests {
106 use super::*;
107
108 #[test]
109 fn test_library_imports() {
110 // Test that all public types are accessible
111 let _ = std::marker::PhantomData::<ExcelError>;
112 let _ = std::marker::PhantomData::<ExcelReader>;
113 let _ = std::marker::PhantomData::<ExcelWriter>;
114 }
115}