NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #661 most downloaded on crates.io
Compile-time string formatting
Last release 5 months ago
17 Apr 2026
Release timing varies
gaps range from 2 weeks to 11 months
Most releases are documented
notes for 23 of 34 stable releases
6 versions withdrawn
withdrawn after publishing
6 years old
40 releases · first in 2020
One column per quarter.
Breaking change: bumped Minimum Supported Rust Version to Rust 1.71. This change is motivated by quote increasing its MSRV to 1.71.
Breaking change: bumped Minimum Supported Rust Version to Rust 1.71. This change is motivated by quote increasing its MSRV to 1.71.
Now the "rust_1_64" feature is effectively always enabled, so these items are always enabled:
const_format::str_splitDeprecated these items because their replacements now take constant time to run:
const_format::fmt::StrWriter::as_bytes_alt: superceeded by as_bytesconst_format::fmt::StrWriter::as_str_alt: superceeded by as_strconst_format::fmt::StrWriterMut::as_bytes_alt: superceeded by as_bytesconst_format::fmt::StrWriterMut::as_str_alt: superceeded by as_strconst_format::utils::slice_up_to_len_alt: superceeded by slice_up_to_lenChanged these methods from being conditionally const (by requiring the "rust_1_64" feature to be const) to being unconditionally const:
const_format::fmt::StrWriter::as_bytesconst_format::fmt::StrWriter::as_strconst_format::fmt::StrWriterMut::as_bytesconst_format::fmt::StrWriterMut::as_strChanged this method to be const:
const_format::AsciiStr::as_strFixed nightly 2026-04-09 compatibility when cargo update -Z minimal-versions is used by bumping konst internal dependency to "0.2.20" version
Breaking change: bumped Minimum Supported Rust Version to Rust 1.60. This change is motivated by quote increasing its MSRV to 1.60.
Breaking change: bumped Minimum Supported Rust Version to Rust 1.60. This change is motivated by quote increasing its MSRV to 1.60.
Breaking change: bumped Minimum Supported Rust Version to Rust 1.57 and changed crate's edition to 2021. This change is motivated by proc-macro2 incre…
This release makes the const_format::fmt API usable on the latest stable (Rust 1.83.0), meaning that no crate feature requires the nightly Rust compiler anymore.
Now all features that used to require nightly only require Rust 1.83.0
Added "rust_1_83" feature that enables "rust_1_64" feature
Changed "fmt" feature to enable "rust_1_83" feature
Made many macros forward compatible with inline const patterns(when the "rust_1_83" feature is enabled):
concatcconcatcpformatcformatcpmap_ascii_casestr_getstr_indexstr_repeatstr_replaceAdded these macros:
str_splice_outstr_split_altFixed Rust Analyzer style warning for assertion macros.
Breaking change: bumped Minimum Supported Rust Version to Rust 1.57 and changed crate's edition to 2021. This change is motivated by proc-macro2 increasing its MSRV to 1.56.
Changed these items that needed the "rust_1_51" feature into always being enabled:
map_ascii_casestr_replaceAdded a workaround for rustdoc bug (rust-lang/rust#112085).
Added lowercase hexadecimal formatting support.
Breaking: to add lowercase hexadecimal formatting, this crate changed the uppercase hexadecimal formatter from {:x} to {:X}
Replacing existing features with these:
"rust_1_64": superceeding the soft-deprecated "more_str_macros" feature."rust_1_51": superceeding the soft-deprecated "const_generics" feature.Now the "fmt" feature enables the "rust_1_64" feature.
Fixed Rust Analyzer style warning for assertion macros.
Fixed Rust Analyzer style warning for assertion macros.
Breaking change: bumped Minimum Supported Rust Version to Rust 1.57 and changed crate's edition to 2021. This change is motivated by proc-macro2 incre…
Breaking change: bumped Minimum Supported Rust Version to Rust 1.57 and changed crate's edition to 2021. This change is motivated by proc-macro2 increasing its MSRV to 1.56.
Changed these items that needed the "rust_1_51" feature into always being enabled:
map_ascii_casestr_replaceAdded a workaround for rustdoc bug (https://github.com/rust-lang/rust/issues/112085).
Added a workaround for rustdoc bug (https://github.com/rust-lang/rust/issues/112085).
Nothing published for this version
Added lowercase hexadecimal formatting support.
Added lowercase hexadecimal formatting support.
Breaking: to add lowercase hexadecimal formatting, this crate changed the uppercase hexadecimal formatter from {:x} to {:X}
Nothing published for this version
"rust_1_64": superceeding the soft-deprecated "more_str_macros" feature.
Replacing existing features with these:
"rust_1_64": superceeding the soft-deprecated "more_str_macros" feature."rust_1_51": superceeding the soft-deprecated "const_generics" feature.
The new features are enabled by the feature they superceede.Now the "fmt" feature enables the "rust_1_64" feature.
This release adds the str_split macro, for splitting a constant string into a constant array of strings, requiring the nightly compiler and "more_str_
This release adds the str_split macro, for splitting a constant string into a constant array of strings, requiring the nightly compiler and "more_str_macros" crate feature.
Added "more_str_macros" crate feature.
Added str_split macro, conditional on the "more_str_macros" feature.
Added char pattern support to str_replace.
Fixed the clippy::double_parens (false positive) warning by encoding the &'static str type annotation some other way.
Made SplicedStr, Formatting, and NumberFormatting derive Eq .
Fixed error that caused formatting macros not to be usable in statement position.
Added type annotations to concatp, concatcp, formatc and formatcp macros to help IDEs infer the type.
Fixed the clippy::double_parens (false positive) warning by encoding the &'static str type annotation some other way.
Fixed the clippy::double_parens (false positive) warning by
encoding the &'static str type annotation some other way.
Made SplicedStr, Formatting, and NumberFormatting derive Eq .
Fixed error that caused formatting macros not to be usable in statement position.
Fixed error that caused formatting macros not to be usable in statement position.
Added type annotations to concatp, concatcp, formatc and formatcp macros to help IDEs infer the type.
Added type annotations to concatp, concatcp, formatc and formatcp macros to help IDEs infer the type.
This release adds the assertcp , assertcp_eq , and assertcp_ne macros for compile-time assertions with formatting. Those macros are enabled with the "
This release adds the assertcp, assertcp_eq, and assertcp_ne macros for compile-time assertions with formatting. Those macros are enabled with the "assercp" feature, and require Rust 1.57.0 to use.
Added the assertcp, assertcp_ne, and assertcp_eq macros under the "assertcp" feature.
Added const_eq methods for PWrapper<&[char]> and PWrapper<Option<char>>
Added the "assertcp" feature, which enables the assertcp* macros.
Aliased "assert" crate feature to "assertc", and removed old name from docs to reduce confusion.
This release improves the assertion failure message for all the assertc* macros.
This release improves the assertion failure message for all the assertc* macros.
Code:
#![feature(const_mut_refs)]
use const_format::{StrWriter, assertc_ne, writec};
use const_format::utils::str_eq;
macro_rules! check_valid_pizza{
($user:expr, $topping:expr) => {
assertc_ne!(
$topping,
"pineapple",
"You can't put pineapple on pizza, {}",
$user,
);
}
}
check_valid_pizza!("John", "salami");
check_valid_pizza!("Dave", "sausage");
check_valid_pizza!("Bob", "pineapple");Error message before:
error: any use of this value will cause an error
--> src/lib.rs:140:1
|
22 | check_valid_pizza!("Bob", "pineapple");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
|
= note: `#[deny(const_err)]` on by default
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: could not evaluate constant
--> /const_format/src/panicking.rs:32:5
|
32 | .
| ^ the evaluated program panicked at '
--------------------------------------------------------------------------------
module_path: rust_out
line: 22
assertion failed: LEFT != RIGHT
left: "pineapple"
right: "pineapple"
You can't put pineapple on pizza, Bob
--------------------------------------------------------------------------------
', /const_format/src/panicking.rs:31:1
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
Error message now:
error[E0080]: evaluation of constant value failed
--> src/lib.rs:171:27
|
21 | check_valid_pizza!("Bob", "pineapple");
| ^^^^^^^^^^^ the evaluated program panicked at '
assertion failed: `(left != right)`
left: `"pineapple"`
right: `"pineapple"`
You can't put pineapple on pizza, Bob
', src/lib.rs:21:27
Rewrote assertion macros to:
Nothing published for this version
Added char support, and deprecated strwriter_as_str macro in favor of new StrWriter::as_str_alt method.
Added char support, and deprecated strwriter_as_str macro in favor of new StrWriter::as_str_alt method.
Added char support to all formatting macros.
Added char, &[char], and Option<char> impls of FormatMarker trait, with debug formatting methods.
Added Formatter::{write_char, write_char_debug} methods.
Added StrWriterMut::{as_str_alt, write_char, write_char_debug} methods.
Added StrWriter::{as_str_alt, unsize} methods.
Deprecated strwriter_as_str macro, superceded by StrWriter::as_str_alt.
Bumped the minimum required nightly version to 2021-07-05 due to use of const-stabilized core::str::from_utf8_unchecked.
Fixed potential soundness bug where unions used to do pointer casts were not #[repr(C)]
Fixed potential soundness bug where unions used to do pointer casts were not #[repr(C)]
Nothing published for this version
This release adds macros that act like methods on &'static str constants.
This release adds macros that act like methods on &'static str constants.
Added these macros that act like str methods:
str_getstr_indexstr_repeatstr_replacestr_spliceAdded the SplicedStr struct.
This release adds a map_ascii_case macro to convert the ascii parts of a &'static str to a particular case.
This release adds a map_ascii_case macro to convert the ascii parts of a &'static str to a particular case.
Added map_ascii_case macro to convert the casing style of a &'static str.
Added the Case enum.
Fixed "constant_time_as_str" crate feature in newer nightlies, this will break code that uses the feature and hasn't updated the nightly compiler to a release post mid-july 2021.
This release makes more use of const generics, unconditionally using them when the "fmt" feature is enabled, and using them to generate less code in t
This release makes more use of const generics, unconditionally using them when the "fmt" feature is enabled, and using them to generate less code in the concatcp and formatcp macros.
Made the const_format::fmt API that uses const generics unconditional, since const generics were stabilized in late 2020 and the fmt API requires the nightly compiler.
Repurposed the "const_generics" feature to generate less code in the concatcp and formatcp macros, by moving some of their implementation to a function that uses const generics.
Fixed a few documentation issues.
This patch release removes the std requirement when using the "assert" feature, and fixes a compilation error introduced in a recent Rust nightly rele
This patch release removes the std requirement when using the "assert" feature, and fixes a compilation error introduced in a recent Rust nightly release.
Fixed the assertion macros not to use std::panic, using core::panic instead, since core::panic changed to allow passing a non-literal &'static str argument.
Fixed the documentation in case that the rust-lang/rust#80243 rustc pull request is merged(not so relevant anymore, now that it's a closed pull request).
Added minimal const generic support, for use in the added methods.
Added these methods to StrWriter<[u8; N]>:
r: for casting it to a StrWriter<[u8]>as_mut: for casting it to a StrWriterMut.Added "const_generics" and "nightly_const_generics" features.
Fixed hygiene bug in assertion macros.
Bumped version number to 0.2.8 .
Made the macros in const_format usable when the crate is renamed.
Added a #[cdeb(crate = "foo")] helper attribute to pass the path to const_format to ConstDebug, useful when reexporting the derive macro.
Documented that writec!(buff, "{foo}") (where foo is a local variable) works, and is equivelent to writec!(buff, "{}", foo).
Nothing published for this version
Fixed the documentation in case that the https://github.com/rust-lang/rust/pull/80243 rustc pull request is merged.
Fixed the documentation in case that the https://github.com/rust-lang/rust/pull/80243 rustc pull request is merged.
Nothing published for this version
Nothing published for this version
Added minimal const generic support, for use in the added methods.
Added minimal const generic support, for use in the added methods.
Added these methods to StrWriter<[u8; N]>:
r: for casting it to a StrWriter<[u8]>as_mut: for casting it to a StrWriterMut.Added "const_generics" and "nightly_const_generics" features.
Fixed hygiene bug in assertion macros.
Bumped version number to 0.2.8 .
Nothing published for this version
Made the macros in const_format usable when the crate is renamed.
Made the macros in const_format usable when the crate is renamed.
Added a #[cdeb(crate = "foo")] helper attribute to
pass the path to const_format to ConstDebug, useful when reexporting the derive macro.
Documented that writec!(buff, "{foo}") (where foo is a local variable) works,
and is equivelent to writec!(buff, "{}", foo).
This release features compile-time assert macros with formatting.
This release features compile-time assert macros with formatting.
Added the "assert" cargo feature,defining the assertc/assertc_eq/assertc_ne macros for compile-time assertions with formatting.
Added custom formatting support in the const_format::fmt-based formatting macros, by prefixing any argument with |identifier|,accessing a Formatter to format that argument however one wants.
Added concatc macro for concatenating std/user-defined types into a &'static str constant.
Added const_format::Result alias for std::result::Result<(), const_format::Error>.
Added const_format::fmt::ToResult type for converting () and const_format::Result to const_format::Result.
Added Pwrapper::const_eq methods for comparing many std types in the assertc_eq/assertc_ne macros.
Added Pwrapper::const_display_fmt methods for NonZero* types.
Added support for passing concat!(....) as the format string.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Every single new item added requires Rust nightly to use, with at least the "fmt" cargo feature enabled.
Every single new item added requires Rust nightly to use, with at least the "fmt" cargo feature enabled.
Defined a core::fmt-like API with these these types:
ComputeStrLength, DebugList, DebugSet, DebugStruct, DebugTuple, Error, Formatter, FormattingFlags, NumberFormatting, StrWriter, StrWriterMut, NoEncoding, Utf8Encoding.
Added formatc macro, for formatting std and user-defined types into a &'static str constant.
Added writec macro, for writing formatted std and user-defined types,
into a type that implements WriteMarker.
Added marker_traits::FormatMarker trait, for types that implement const formatting,
with either the const_debug_fmt, or const_display_fmt inherent methods.
Added ConstDebug derive macro, for implementing FormatMarker,
and implement the const_debug_fmt inherent method.
Added marker_traits::WriteMarker trait, for types that can be written into,
defining the borrow_mutably and make_formatter methods.
Added these type in marker_traits module: IsAFormatMarker, IsAStrWriter, IsAWriteMarker,
IsArrayKind, IsNotAStrWriter, IsNotStdKind, IsStdKind
Added hexadecimal and binary formatting to the formatcp macro
(also usable in formatc, and writec)
Defined the AsciiStr type, a wrapper type for &[u8] slices which are valid ascii,
with an ascii_str macro for constructing it at compile-time,
and wrapper_types::NotAsciiError returned by the fallible constructor.
Exposed the PWrapper type, wrapper for std types to call some methods on them.
Defined the Sliced type, to output a slice from a &str.
Defined these macros for implementing/doing compile-time formatting:
call_debug_fmt, coerce_to_fmt, impl_fmt
Defined the strwriter_as_str macro to cast a &'static StrWriter to a &'static str
Defined these error handling macros: try_, unwrap, unwrap_or_else
Defined the for_examples module with examples of types that implement const formatting.
Defined these utility functions in the utils module:
slice_up_to_len, slice_up_to_len_alt, str_eq u8, slice_eq
Fixed error reporting in formatcp and concatcp macros,
now compiler errors point at the argument that caused an error rather than the whole macro invocation.
Added the "fmt" cargo feature, to enable the fmt-like API, and every other thing that depends on it.
Added the "derive" cargo feature, to enable the ConstDebug macro.
Added the "constant_time_as_str", to optimize some methods, requires additional nightly features.
Made syn an optional dependency, only enabled when the "derive" feature is used.
Added unicode-xid dependency.
Created const_format crate,
const_format_proc_macros crate(implementation detail of const_format)
Defined the concatcp macro,
for concatenating constants of primitive types into a &'static str constant.
Defined the formatcp macro,
for formatting constants of primitive types into a &'static str constant.
Added dependencies: syn with none of the expensive features, quote, proc_macro2
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →