docx_lite/lib.rs
1//! # docx-lite
2//!
3//! A lightweight, fast DOCX text extraction library with minimal dependencies.
4//!
5//! ## Features
6//! - Zero unsafe code
7//! - Minimal dependencies (only zip, quick-xml, thiserror)
8//! - Fast text extraction
9//! - Support for paragraphs, tables, and basic formatting
10//! - Graceful error handling for malformed documents
11//!
12//! ## Quick Start
13//!
14//! ```no_run
15//! use docx_lite::extract_text;
16//!
17//! fn main() -> Result<(), Box<dyn std::error::Error>> {
18//! let text = extract_text("document.docx")?;
19//! println!("{}", text);
20//! Ok(())
21//! }
22//! ```
23//!
24//! ## Advanced Usage
25//!
26//! ```no_run
27//! use docx_lite::parse_document_from_path;
28//!
29//! fn main() -> Result<(), Box<dyn std::error::Error>> {
30//! let doc = parse_document_from_path("document.docx")?;
31//!
32//! for paragraph in &doc.paragraphs {
33//! println!("Paragraph: {}", paragraph.to_text());
34//! }
35//!
36//! for table in &doc.tables {
37//! println!("Table with {} rows", table.rows.len());
38//! }
39//!
40//! Ok(())
41//! }
42//! ```
43
44pub mod error;
45pub mod types;
46pub mod parser;
47pub mod extractor;
48
49// Re-export main types and functions
50pub use error::{DocxError, Result};
51pub use types::{
52 Document, Paragraph, Run, Table, TableRow, TableCell,
53 ListItem, ListType, HeaderFooter, HeaderFooterType,
54 Note, NoteType, ExtractOptions
55};
56pub use extractor::{
57 extract_text,
58 extract_text_from_bytes,
59 extract_text_from_reader,
60 parse_document,
61 parse_document_from_path,
62};