7 releases

0.3.1 May 20, 2022
0.3.0 Feb 4, 2022
0.2.1 Feb 2, 2022
0.2.0 Dec 11, 2021
0.1.0 Jul 10, 2021

#704 in Rust patterns

Download history 1989/week @ 2024-06-15 1611/week @ 2024-06-22 1590/week @ 2024-06-29 2351/week @ 2024-07-06 2321/week @ 2024-07-13 1865/week @ 2024-07-20 2086/week @ 2024-07-27 2149/week @ 2024-08-03 1819/week @ 2024-08-10 2092/week @ 2024-08-17 2916/week @ 2024-08-24 1505/week @ 2024-08-31 1638/week @ 2024-09-07 2398/week @ 2024-09-14 2403/week @ 2024-09-21 2237/week @ 2024-09-28

8,895 downloads per month
Used in 4 crates

Apache-2.0

36KB
693 lines

rt-format

Fully-runtime equivalent of the format! macro.

Allows formatting strings like the format! macro, with the formatting string and the arguments provided at runtime. This crate supports all the formatting features of the format! macro, except for the fill character.

When (not) to use this crate

There are many crates that can be used for formatting values into strings. Here are some of the criteria you can use to decide if this crate is the right choice for you:

  • Can you specify all the formatting options at compile time? If yes, then std::fmt is a better option than this crate. If you need to supply the formatting specifiers at runtime, then this crate might be a viable option.
  • Are you formatting only numbers? If yes, consider num-runtime-fmt or num-format.
  • Is using Rust nightly an option? If so, consider runtime-fmt.
  • Do you need the ability to implement new formats? If yes, consider dynfmt.
  • Do you need no-std support? If so, you need to use one of the other alternatives.
  • Is formatting likely to be a performance bottleneck for you? If so, you should consider one of the other alternatives. At this time, there are no benchmarks to compare the approach in this crate with other crates.
  • Is stable API a must-have? If so, you might consider the alternatives. This crate is still not at version 1.0, which means that the API is still not completely stable.

Dependencies

~2.1–3MB
~54K SLoC