lib_epub/lib.rs
1//! Epub library
2//!
3//! A Rust library for reading and manipulating EPUB eBook files.
4//!
5//! This library provides complete EPUB file parsing functionality,
6//! supporting EPUB 2 and EPUB 3 formats. It can extract metadata,
7//! access content files, and handle encrypted resources.
8//! Furthermore, this library also provides a convenient way to build
9//! epub files from a set of resources.
10//!
11//! ## Features
12//!
13//! - Parse EPUB file structure and containers, extract metadata, access resource files.
14//! - Automatic handle encrypted content.
15//! - Optional EPUB build functionality via 'builder' feature.
16//! - EPUB specification-compliant verification mechanism.
17//!
18//! ## Quick Start
19//!
20//! ### Read EPUB Files
21//!
22//! ```rust, ignore
23//! # use lib_epub::epub::EpubDoc;
24//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
25//! // Open EPUB file
26//! let doc = EpubDoc::new("path/to/epub/file.epub")?;
27//!
28//! // Get metadata
29//! println!("Title: {:?}", doc.get_title()?);
30//! println!("Creator: {:?}", doc.get_metadata_value("creator")?);
31//!
32//! // Read content
33//! let (_content, _mime) = doc.spine_current()?;
34//! let (_content, _mime) = doc.next_spine()?;
35//!
36//! # Ok(())
37//! # }
38//! ```
39//!
40//! ### Enable Builder Feature
41//!
42//! Enable the builder feature in `Cargo.toml`:
43//!
44//! ```toml
45//! [dependencies]
46//! lib-epub = { version = "0.0.5", features = ["builder"] }
47//! ```
48//!
49//! ## Module Description
50//!
51//! - [epub] - Core functionality for EPUB document parsing
52//! - [error] - Error type definition
53//! - [types] - Data structure definition
54//! - [builder] - EPUB build functionality (requires enabling the `builder` feature)
55//!
56//! ### Exported Trait
57//!
58//! - [DecodeBytes] - Byte data decoding trait, used to convert raw bytes into strings
59
60pub(crate) mod utils;
61
62#[cfg(feature = "builder")]
63pub mod builder;
64pub mod epub;
65pub mod error;
66pub mod types;
67
68pub use utils::DecodeBytes;