Skip to main content

Crate smart_format

Crate smart_format 

Source
Expand description

Composable, zero-allocation Display formatting combinators for Rust.

smart-format provides extension traits that add formatting operations to any type implementing core::fmt::Display. Each operation returns a lightweight wrapper struct that itself implements Display, so operations compose without intermediate allocations.

§Design

The core idea: a struct that wraps T: Display and implements Display with a transformation is a zero-allocation combinator by construction. Chain them, and you get a streaming pipeline that composes through core::fmt::Formatter without intermediate String allocations.

Domain-specific transforms (HTML escaping, URL encoding, XML CDATA) are available behind feature flags so you only pay for what you use.

§Features

  • html — HTML escape, unescape, and attribute formatting
  • url — URL percent-encoding (adds percent-encoding dependency)
  • xml — XML CDATA wrapping
  • full — enables all of the above

Modules§

case
combinator
iter
prelude
str_buffer

Traits§

DisplayExt