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//! ## Feature flags
41//!
42//! This crate uses 2 feature flags to reduce the needless code for your project.
43//! By default, this crate only provides structs and trait related to reading and parsing EPUB documents.
44//! If you want to use more features related to EPUB, please use the feature flag
45//! to turn on the section you need.
46//!
47//! - `builder`: Enable `lib_epub::builder`, provides structs and trait related to building EPUB documents.
48//! - `content_builder`: Enable `lib_epub::builder::content`, provides structs and trait
49//! related to building EPUB content documents. Enabling this feature will turn on
50//! the `builder` feature by default.
51
52pub(crate) mod utils;
53
54#[cfg(feature = "builder")]
55pub mod builder;
56pub mod epub;
57pub mod error;
58pub mod types;
59
60pub use utils::DecodeBytes;