ryu
Fast floating point to string conversion
This package has a good security score with no known vulnerabilities.
Community Reviews
Rock-solid, minimal dependency formatter with zero security surface area
The API is dead simple - you're typically using it indirectly through serde_json or directly via `Buffer::new().format(value)`. There's no input validation needed because it accepts primitive float types directly from Rust's type system. Error handling is essentially non-existent because the operation is infallible for valid floats. This simplicity is a security win: no error messages that could leak information, no edge cases with exceptions.
The library follows secure-by-default principles perfectly because there's nothing to configure wrong. It just works deterministically. The maintainer has shown excellent CVE response historically (though there have been none for this crate), and the code is straightforward enough to audit in an afternoon. For float serialization in security-sensitive contexts, this is as safe as it gets.
Best for: Any project requiring fast, deterministic float-to-string conversion where supply chain security and minimal attack surface are priorities.
Avoid if: You need locale-aware formatting or custom precision controls beyond standard Ryu output.
Rock-solid, zero-config float formatting with excellent ergonomics
What really stands out is how it drops into existing codebases. Replacing standard library formatting with ryu is typically a one-line change, and the performance gains are immediate and measurable. Error handling is non-existent because the operations are infallible—no Result types to unwrap, which simplifies calling code considerably.
Documentation is lean but complete. The README covers the 95% use case in seconds, and rustdoc explains the few API surfaces clearly. No surprises, no gotchas. The crate follows Rust conventions perfectly, so if you know Rust, you know ryu. It's the kind of library that you add once and never think about again.
Best for: Projects needing fast, standards-compliant float-to-string conversion without configuration overhead.
Avoid if: You need highly customized numeric formatting with precision control or locale-specific separators.
Dead simple drop-in replacement that just works
In practice, integration is painless. I've used it in both performance-critical serialization code and general-purpose formatting. Error handling is non-existent because the operations are infallible (you're just formatting numbers). The only gotcha is remembering to use the buffer for stack allocation when performance matters, but even if you forget and use the convenience methods, it still works fine.
Debugging is trivial since there's almost no surface area for things to go wrong. The output matches Rust's standard formatting, so there are no surprises. Common use cases like JSON serialization or CSV export are completely straightforward—just swap your `to_string()` calls with ryu and enjoy the speedup.
Best for: Any project needing faster float-to-string conversion, especially serialization libraries and data export tools.
Avoid if: You need custom float formatting options beyond standard decimal representation.
Sign in to write a review
Sign In