Expand description
Async, range-fetching PDF access for pdfboss: open huge files without loading them, hold many documents concurrently, and read remote PDFs over HTTP range requests. Built sans-I/O style on the synchronous pdfboss-core machinery: bytes are fetched in small windows and handed to the existing sync lexer, parser and filters. The whole file is never read.
Re-exports§
pub use backend::Backend;pub use backend::FileBackend;pub use backend::MemBackend;pub use cache::CachedBackend;pub use document::AsyncDocument;pub use error::Error;pub use error::Result;pub use stream::ElementStream;
Modules§
- backend
- Random-access byte sources: in-memory bytes, positioned file reads on a
blocking thread, and (behind the
httpfeature) remote HTTP range requests with a one-time full-download fallback for range-less servers. The trait is object-safe — futures are boxed — so documents can holdArc<dyn Backend>. - cache
- Chunked LRU read cache over any backend: many small reads become few chunk-sized fetches, and hot chunks stay resident up to a byte budget. Default 64 KiB chunks, 32 MiB cap. Misses batch adaptively: a miss landing near the previous one doubles the batch (up to 8 MiB), a far one halves it, and each miss fetches its uncached neighborhood in one inner read, so dense access over a high-latency backend collapses into few large requests while scattered access stays at one chunk per miss.
- document
- The async document model: opening fetches only the file tail, the xref chain and the page-tree nodes; objects are fetched span-by-span through growing windows and parsed by the sync core machinery. The whole file is never read.
- error
- Error type for pdfboss-aio: wraps core parse errors and transport failures, with a dedicated variant for short reads. Messages are prefixed by layer (“parse:”, “io:”, “http:”) so downstream consumers can present them uniformly.
- stream
- A lazy element stream mirroring the sync iterator’s ordering and salvage semantics: physical elements first (header when present, objects by offset with object-stream members after their container, xref sections in chain order, one merged trailer, startxref, eof), then logical elements in document order. Nothing is fetched, parsed or decoded before it is yielded; logical elements are prepared one page at a time.