Expand description
Prepared-document layout with application-owned annotations and reusable allocation control.
§Example
use std::num::NonZeroU32;
use laidout::{render, Doc, RenderOptions};
let doc = Doc::<u32>::group(Doc::concat([
Doc::text("status"),
Doc::line(),
Doc::text("ready"),
]));
let options = RenderOptions::new(NonZeroU32::new(12).unwrap());
let output = render(&doc, options)?;
assert_eq!(output.text(), "status ready");Re-exports§
pub use cost::ConsumerCost;pub use doc::Doc;pub use doc::TagId;pub use doc::TextError;pub use doc::TextErrorKind;pub use doc::TextRun;pub use doc::WidthMode;pub use table::table;pub use table::Alignment;pub use table::Column;pub use table::Table;pub use table::TableError;pub use table::TableErrorKind;pub use text::from_text;pub use text::from_text_with;pub use text::from_text_with_annotations;pub use text::IngestOptions;pub use text::TextKind;
Modules§
- cost
- Checked compact consumer costs and optional unbounded research costs.
- doc
- Opaque, annotation-generic source documents.
- measure
- Allocation-free retained-footprint telemetry for the prepared consumer kernel.
- prelude
- Common document construction and rendering types.
- research
- Allocating compatibility engines for arbitrary cost models.
- table
- Pure static compilation for aligned tables with flat cells.
- tags
- Built-in semantic tags used by text ingestion and token constructors.
- text
- Ingest unstructured text into the document algebra.
- tokens
- Small, classified token constructors for formatter ergonomics.
Structs§
- Active
Annotations - Read-only view of annotations active at one visitor event.
- Annotated
Run - A contiguous text run and the annotations active over it.
- Annotation
Id - Result-local identifier for one prepared annotation value.
- Annotation
Span - Structural annotation span over rendered UTF-8 bytes.
- Exact
Solve Capacity - Logical capacity retained for the Exact solver.
- Fast
Solve Capacity - Logical capacity retained for the Fast solver.
- Layout
Ref - Borrowed solved layout that exclusively holds its workspace until visited or dropped.
- Materialize
Capacity - Logical capacity retained for output materialization.
- Prepared
Bounds - Conservative, width-independent bounds computed during preparation.
- Prepared
Doc - Immutable dense representation prepared for repeated layout.
- Render
Capacity - Complete logical capacity of a reusable workspace.
- Render
Options - Immutable options for one solve or render operation.
- Render
Summary - Cost and solver telemetry returned by a sink write.
- Render
Workspace - Reusable storage for solving, visiting, and materializing layouts.
- Rendered
- An owned rendering, including annotation spans and solver telemetry.
- Rendered
Parts - Independently owned fields extracted from a
Renderedvalue. - Rendered
Ref - Borrowed materialized result that exclusively holds its workspace until dropped.
- Renderer
- Stateful owned and sink renderer with reusable workspace.
- Solve
Stats - Deterministic counters produced by a completed or failed solve.
- SpanId
- Result-local index of one annotation span.
- Visit
Capacity - Logical capacity retained for selected-layout visitation.
Enums§
- Cost
Component - Production cost component checked during preparation.
- Indent
Policy - Policy applied when structural indentation exceeds the target width.
- Layout
Strategy - Layout algorithm used for one solve.
- Owned
Output Resource - An owned output buffer that failed allocation.
- Owned
Render Error - Failure from an allocating convenience renderer.
- Owned
Render Error Kind - Stable category for an
OwnedRenderError. - Prepare
Error - Failure while preparing a source document for repeated solving.
- Prepare
Error Kind - Stable category for a
PrepareError. - Prepared
Resource - Prepared representation resource that exceeded its production domain.
- Render
Error - Failure while solving, visiting, or materializing a prepared document.
- Render
Error Kind - Stable category for a
RenderError. - Reserve
Error - Failure while explicitly reserving workspace storage.
- Reserve
Error Kind - Stable category for a
ReserveError. - Solve
Counter - Named statistic that exceeded its production counter domain.
- Visit
Error - Failure from either layout replay or the consumer visitor.
- Workspace
Mode - Allocation policy for a reusable workspace.
- Workspace
Resource - Named logical storage resource in a
RenderWorkspace. - Write
Error - Failure from rendering directly into a caller-provided sink.
Traits§
- Layout
Visitor - Receives a solved structural layout without forcing text materialization.
Functions§
- render
- Prepare and render a document using a temporary growable renderer.
- render_
into - Solves and materializes a prepared document into borrowed workspace storage.
- render_
prepared - Render a prepared document using a temporary growable renderer.
- render_
prepared_ into_ owned - Render a prepared document into owned output using caller-owned workspace.
- solve_
into - Solves a prepared document into a structural layout without materializing text.