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.
Documentation
Features
Here is a non-exhaustive list of the features rbook provides:
| 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 | On-demand retrieval of bytes or strings for any manifest resource; data is not loaded up-front until requested. | resource module |
Default crate features
These are toggleable features for rbook that are
enabled by default in a project's Cargo.toml file:
| Feature | Description |
|---|---|
| prelude | Convenience prelude only including common traits. |
| threadsafe | Enables Send + Sync constraint for Epub. |
Usage
rbook can be used by adding it as a dependency in a project's Cargo.toml file:
[]
= "0.6.10" # With default features
# rbook = { version = "0.6.10", default-features = false } # Excluding default features
WebAssembly
The wasm32-unknown-unknown target is supported by default.
Examples
Opening and reading an EPUB file
use ; // Prelude for traits
Accessing metadata: Retrieving the main title
use ;
use ;
Accessing metadata: Retrieving the first creator
use ;
use LanguageKind;
Extracting images from the manifest
use ;
use ;
More examples are available in the documentation: https://docs.rs/rbook
License
Licensed under Apache License, Version 2.0.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.