rbook

A fast, format-agnostic, ergonomic ebook library with a focus on EPUB.
The primary goal of rbook is to provide an easy-to-use high-level API for handling ebooks.
Most importantly, this library is designed with future formats in mind
(CBZ, FB2, MOBI, etc.) via core traits defined within the ebook
and reader module, allowing all formats to share the same "base" API.
Features
| Feature | Overview | Documentation |
|---|---|---|
| EPUB 2 and 3 | Read-only (for now) view of EPUB 2 and 3 formats. |
epub module |
| Reader | Random‐access or sequential iteration over readable content. | reader module |
| Detailed Types | Abstractions built on expressive traits and types. | |
| Metadata | Typed access to titles, creators, publishers, languages, tags, roles, attributes, and more. | metadata module |
| Manifest | Lookup and traverse contained resources such as readable content (XHTML) and images. | manifest module |
| Spine | Chronological reading order and preferred page direction. | spine module |
| Table of Contents (ToC) | Navigation points, including the EPUB 2 guide and EPUB 3 landmarks. | toc module |
| Resources | Retrieve bytes or UTF-8 strings for any manifest resource. | resource module |
Documentation
Usage
rbook can be used by adding it as a dependency in a project's cargo.toml file:
[]
= "0.6.6" # with default features
# rbook = { version = "0.6.6", default-features = false } # excluding default features
Default crate features:
prelude: Convenience prelude only including common traits.threadsafe: Enables constraint and support forSend + Sync.
WebAssembly
The wasm32-unknown-unknown target is supported by default.
Examples
Opening and reading an EPUB file
use ;
use *; // Prelude for traits
Accessing metadata: Retrieving the main title
use Epub;
use ;
use *;
Accessing metadata: Retrieving the first creator
use Epub;
use LanguageKind;
use *;
Extracting images from the manifest
use Epub;
use *;
use ;
use Path;
use Write;
More examples are available in the documentation: https://docs.rs/rbook