Skip to main content

Crate docspec_core

Crate docspec_core 

Source
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 u32 counter for nesting-depth tracking.
DocumentMeta
Metadata attached to the document.
Position
The position in a source document where an error occurred.
StackTrackingSink
A wrapper around any EventSink that tracks the nesting stack of open block-level containers and performs event-stream normalization.
TextStyle
Text formatting attributes for an Event::Text event.

Enums§

BlockKind
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.
ImageSource
A reference to an image asset, either embedded or external.
ListStyleType
The specific visual style for a list.
TableHeaderScope
Scope of a table header cell.
TextAlignment
Text alignment options for paragraphs.

Traits§

AssetProvider
Provides access to binary assets referenced in the event stream.
EventSink
Consumes a stream of crate::Events to produce output.
EventSource
Produces a stream of crate::Events from a document source.

Functions§

block_kind_for_end
Returns the BlockKind for an end event, or None if the event is not a block end.
block_kind_for_start
Returns the BlockKind for a start event, or None if the event is not a block start.
pipe
Pull events from source and push them into sink until the source drains, then call EventSink::finish on the sink.

Type Aliases§

Result
Result type alias for DocSpec operations.