lib_epub/
lib.rs

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