Expand description
§Laminate — Data, shaped layer by layer
Progressive data shaping for Rust. Bonds layers of structure onto raw data — progressively, configurably, without breaking.
Laminate sits between fully dynamic (serde_json::Value) and fully typed
(#[derive(Deserialize)]), providing a progressive pipeline for shaping
unstructured data into typed Rust values.
§Quick Start
use laminate::FlexValue;
let val = FlexValue::from_json(r#"{"port": "8080", "debug": "true"}"#).unwrap();
// Type coercion happens automatically
let port: u16 = val.extract("port").unwrap(); // "8080" → 8080
let debug: bool = val.extract("debug").unwrap(); // "true" → true§Path Navigation
use laminate::FlexValue;
let val = FlexValue::from_json(r#"{"users": [{"name": "Alice"}]}"#).unwrap();
let name: String = val.extract("users[0].name").unwrap();§Features
core(default) — FlexValue, path access, coercion, modes, diagnosticsderive—#[derive(Laminate)]macrostreaming— SSE parser, Anthropic/OpenAI stream handlersproviders— Provider normalization adaptersregistry— Handler dispatch for tool callsschema— Schema inference and data auditingfull— All features
Re-exports§
pub use coerce::Coercible;pub use coerce::CoercionLevel;pub use diagnostic::CollectSink;pub use diagnostic::Diagnostic;pub use diagnostic::DiagnosticKind;pub use diagnostic::DiagnosticSink;pub use diagnostic::FilteredSink;pub use diagnostic::NullSink;pub use diagnostic::RiskLevel;pub use diagnostic::StderrSink;pub use diagnostic::StopReason;pub use error::FlexError;pub use error::Result;pub use mode::Absorbing;pub use mode::DynamicMode;pub use mode::LaminateResult;pub use mode::Lenient;pub use mode::Mode;pub use mode::Overflow;pub use mode::Strict;pub use value::FlexValue;pub use provider::ContentBlock;pub use provider::NormalizedResponse;pub use provider::ProviderAdapter;pub use provider::Usage;pub use registry::HandlerRegistry;pub use schema::AuditReport;pub use schema::InferredSchema;pub use streaming::FlexStream;pub use streaming::Provider;pub use streaming::StreamConfig;pub use streaming::StreamEvent;
Modules§
- coerce
- Type coercion engine — the core of laminate’s data shaping.
- detect
- Type detection —
guess_type()identifies what kind of data a string contains. Type detection module — identify what kind of data a string contains. - diagnostic
- Graduated diagnostics — every coercion, default, and drop is recorded.
- error
- Error types for laminate operations.
- mode
- Operational modes for progressive data shaping.
- packs
- Domain coercion packs — built-in domain-specific detection, parsing, and conversion.
- path
- Path parser for dot/bracket navigation syntax.
- provider
- Provider normalization — map provider-specific response shapes to a common envelope.
- registry
- Handler registry for dispatching tool calls to typed handler functions.
- schema
- Schema inference and data auditing.
- streaming
- Streaming SSE parser with pluggable event handlers.
- value
- FlexValue — the core navigable JSON wrapper with path access, coercion, and diagnostics.
Derive Macros§
- Laminate
- Derive macro for progressive data shaping.
- Tool
Definition - Derive macro for generating LLM tool definition JSON schemas.