Skip to main content

Crate boko

Crate boko 

Source
Expand description

§boko

A high-performance, format-agnostic ebook processing engine.

§Architecture

Boko uses an Importer architecture for reading ebooks:

  • Book is the runtime handle that wraps format-specific backends
  • Importer trait defines the interface for format backends
  • Lazy loading via ByteSource for efficient random access

§Supported Formats

FormatReadWrite
EPUB
AZW3
MOBI-

§Quick Start

use boko::Book;

let mut book = Book::open("input.epub")?;
println!("Title: {}", book.metadata().title);

// Iterate chapters (collect spine first to avoid borrow issues)
let spine: Vec<_> = book.spine().to_vec();
for entry in spine {
    let content = book.load_raw(entry.id)?;
    println!("Chapter: {} bytes", content.len());
}

Re-exports§

pub use book::Book;
pub use book::Format;
pub use book::Metadata;
pub use book::Resource;
pub use book::TocEntry;
pub use compiler::Origin;
pub use compiler::Stylesheet;
pub use compiler::compile_html;
pub use export::Azw3Exporter;
pub use export::EpubExporter;
pub use export::Exporter;
pub use export::TextConfig;
pub use export::TextExporter;
pub use export::TextFormat;
pub use import::ChapterId;
pub use import::Importer;
pub use import::SpineEntry;
pub use io::ByteSource;
pub use io::FileSource;
pub use ir::ComputedStyle;
pub use ir::IRChapter;
pub use ir::ListStyleType;
pub use ir::Node;
pub use ir::NodeId;
pub use ir::Role;
pub use ir::SemanticMap;
pub use ir::StyleId;
pub use ir::StylePool;
pub use ir::TextRange;
pub use ir::ToCss;

Modules§

book
Core data types and runtime handle for ebooks.
compiler
HTML to IR compiler pipeline.
epub
EPUB format support - pure parsing functions.
export
Export module for writing ebooks to various formats.
import
Format importers for reading ebook files.
io
IO Abstractions for random-access byte reading.
ir
Intermediate Representation (IR) for normalized ebook content.
kfx
KFX (KF10) format reader and writer.
mobi
MOBI/AZW3 format support.