Skip to main content

Crate laidout

Crate laidout 

Source
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§

ActiveAnnotations
Read-only view of annotations active at one visitor event.
AnnotatedRun
A contiguous text run and the annotations active over it.
AnnotationId
Result-local identifier for one prepared annotation value.
AnnotationSpan
Structural annotation span over rendered UTF-8 bytes.
ExactSolveCapacity
Logical capacity retained for the Exact solver.
FastSolveCapacity
Logical capacity retained for the Fast solver.
LayoutRef
Borrowed solved layout that exclusively holds its workspace until visited or dropped.
MaterializeCapacity
Logical capacity retained for output materialization.
PreparedBounds
Conservative, width-independent bounds computed during preparation.
PreparedDoc
Immutable dense representation prepared for repeated layout.
RenderCapacity
Complete logical capacity of a reusable workspace.
RenderOptions
Immutable options for one solve or render operation.
RenderSummary
Cost and solver telemetry returned by a sink write.
RenderWorkspace
Reusable storage for solving, visiting, and materializing layouts.
Rendered
An owned rendering, including annotation spans and solver telemetry.
RenderedParts
Independently owned fields extracted from a Rendered value.
RenderedRef
Borrowed materialized result that exclusively holds its workspace until dropped.
Renderer
Stateful owned and sink renderer with reusable workspace.
SolveStats
Deterministic counters produced by a completed or failed solve.
SpanId
Result-local index of one annotation span.
VisitCapacity
Logical capacity retained for selected-layout visitation.

Enums§

CostComponent
Production cost component checked during preparation.
IndentPolicy
Policy applied when structural indentation exceeds the target width.
LayoutStrategy
Layout algorithm used for one solve.
OwnedOutputResource
An owned output buffer that failed allocation.
OwnedRenderError
Failure from an allocating convenience renderer.
OwnedRenderErrorKind
Stable category for an OwnedRenderError.
PrepareError
Failure while preparing a source document for repeated solving.
PrepareErrorKind
Stable category for a PrepareError.
PreparedResource
Prepared representation resource that exceeded its production domain.
RenderError
Failure while solving, visiting, or materializing a prepared document.
RenderErrorKind
Stable category for a RenderError.
ReserveError
Failure while explicitly reserving workspace storage.
ReserveErrorKind
Stable category for a ReserveError.
SolveCounter
Named statistic that exceeded its production counter domain.
VisitError
Failure from either layout replay or the consumer visitor.
WorkspaceMode
Allocation policy for a reusable workspace.
WorkspaceResource
Named logical storage resource in a RenderWorkspace.
WriteError
Failure from rendering directly into a caller-provided sink.

Traits§

LayoutVisitor
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.