Expand description
Core event types and traits for the DocSpec streaming document conversion library.
DocSpec converts documents through a streaming event pipeline. This crate defines
the Event enum, supporting types, error types, and the EventSource,
EventSink, and AssetProvider traits that decouple readers from writers.
§Quick Start
Implement EventSource to produce events and EventSink to consume them.
Events represent document structure (headings, paragraphs, tables, text runs).
Readers and writers are fully decoupled through the event protocol.
§Event Types
The Event enum covers all document structures defined in the DocSpec
specification. See EVENTS.md for the authoritative variant list and semantics.
Structs§
- Author
- An author with a name and optional email address.
- Depth
- A saturating
u32counter for nesting-depth tracking. - Document
Meta - Metadata attached to the document.
- Position
- The position in a source document where an error occurred.
- Stack
Tracking Sink - A wrapper around any
EventSinkthat tracks the nesting stack of open block-level containers and performs event-stream normalization. - Text
Style - Text formatting attributes for an
Event::Textevent.
Enums§
- Block
Kind - Identifies the kind of block-level container in a document event stream.
- Color
- An RGB color value.
- Error
- Errors that can occur during document processing.
- Event
- A streaming document event.
- Image
Source - A reference to an image asset, either embedded or external.
- List
Style Type - The specific visual style for a list.
- Table
Header Scope - Scope of a table header cell.
- Text
Alignment - Text alignment options for paragraphs.
Traits§
- Asset
Provider - Provides access to binary assets referenced in the event stream.
- Event
Sink - Consumes a stream of
crate::Events to produce output. - Event
Source - Produces a stream of
crate::Events from a document source.
Functions§
- block_
kind_ for_ end - Returns the
BlockKindfor an end event, orNoneif the event is not a block end. - block_
kind_ for_ start - Returns the
BlockKindfor a start event, orNoneif the event is not a block start. - pipe
- Pull events from
sourceand push them intosinkuntil the source drains, then callEventSink::finishon the sink.
Type Aliases§
- Result
- Result type alias for
DocSpecoperations.