Skip to main content

Crate epub_stream

Crate epub_stream 

Source
Expand description

epub-stream – Memory-efficient EPUB parser for embedded systems

Streaming EPUB parser designed for constrained devices. Provides SAX-style XML parsing, XHTML tokenization, and optional text layout/pagination.

§Features

  • std (default) – enables streaming ZIP reader and file I/O
  • layout – text layout engine for pagination

§Allocation Behavior

This crate uses an alloc-bounded design with explicit limits on all expensive entrypoints. The primary APIs require caller-provided buffers or scratch space (*_with_scratch, *_into). Convenience APIs that allocate (read_resource() -> Vec<u8>) are available only with the std feature and are clearly marked as non-embedded-fast-path.

Re-exports§

pub use async_api::open_epub_file_async;
pub use async_api::open_epub_file_async_with_options;
pub use book::parse_epub_file;
pub use book::parse_epub_file_with_options;
pub use book::parse_epub_reader;
pub use book::parse_epub_reader_with_options;
pub use book::ChapterRef;
pub use book::ChapterStreamResult;
pub use book::CoverImageOptions;
pub use book::CoverImageRef;
pub use book::CoverImageSource;
pub use book::EpubBook;
pub use book::EpubBookBuilder;
pub use book::EpubBookOptions;
pub use book::EpubSummary;
pub use book::ImageReadOptions;
pub use book::Locator;
pub use book::PaginationSession;
pub use book::ReadingPosition;
pub use book::ReadingSession;
pub use book::ResolvedLocation;
pub use book::ValidationMode;
pub use css::CssStyle;
pub use css::Stylesheet;
pub use error::EpubError;
pub use error::ErrorLimitContext;
pub use error::ErrorPhase;
pub use error::LimitKind;
pub use error::PhaseError;
pub use error::PhaseErrorContext;
pub use error::ZipError;
pub use error::ZipErrorKind;
pub use metadata::EpubMetadata;
pub use navigation::Navigation;
pub use render_prep::BlockRole;
pub use render_prep::ChapterStylesheets;
pub use render_prep::ComputedTextStyle;
pub use render_prep::EmbeddedFontFace;
pub use render_prep::EmbeddedFontStyle;
pub use render_prep::FontFallbackPolicy;
pub use render_prep::FontLimits;
pub use render_prep::FontPolicy;
pub use render_prep::FontResolutionTrace;
pub use render_prep::FontResolver;
pub use render_prep::LayoutHints;
pub use render_prep::MemoryBudget;
pub use render_prep::PreparedChapter;
pub use render_prep::RenderPrep;
pub use render_prep::RenderPrepError;
pub use render_prep::RenderPrepOptions;
pub use render_prep::RenderPrepTrace;
pub use render_prep::ResolvedFontFace;
pub use render_prep::StyleConfig;
pub use render_prep::StyleLimits;
pub use render_prep::StyledChapter;
pub use render_prep::StyledEvent;
pub use render_prep::StyledEventOrRun;
pub use render_prep::StyledImage;
pub use render_prep::StyledRun;
pub use render_prep::Styler;
pub use render_prep::StylesheetSource;
pub use spine::Spine;
pub use streaming::ChunkAllocator;
pub use streaming::ChunkLimits;
pub use streaming::PaginationContext;
pub use streaming::ScratchBuffers;
pub use streaming::StreamingChapterProcessor;
pub use streaming::StreamingStats;
pub use tokenizer::tokenize_html_into;
pub use tokenizer::tokenize_html_limited;
pub use tokenizer::tokenize_html_with_scratch;
pub use tokenizer::Token;
pub use tokenizer::TokenizeError;
pub use tokenizer::TokenizeLimits;
pub use tokenizer::TokenizeScratch;
pub use validate::validate_epub_file;
pub use validate::validate_epub_file_with_options;
pub use validate::validate_epub_reader;
pub use validate::validate_epub_reader_with_options;
pub use validate::ValidationDiagnostic;
pub use validate::ValidationOptions;
pub use validate::ValidationReport;
pub use validate::ValidationSeverity;
pub use zip::ZipLimits;

Modules§

async_api
Optional async helpers for high-level EPUB opening.
book
High-level EPUB API for common workflows.
css
CSS subset parser for EPUB styling
error
Unified error types for epub-stream
layout
Text layout engine for EPUB pagination
metadata
EPUB metadata parser using quick-xml SAX-style parsing
navigation
EPUB navigation parsing (TOC, page list, landmarks)
render_prep
Stream-first style/font preparation APIs for rendering pipelines.
spine
EPUB spine parser and chapter navigation
streaming
Streaming chapter reader for memory-efficient EPUB processing.
tokenizer
XHTML to token stream converter for EPUB content
validate
EPUB validation helpers and structured diagnostics.
zip
Streaming ZIP reader for EPUB files