|0.4.8||Feb 16, 2023|
|0.4.6||Nov 3, 2022|
|0.4.0||Jun 18, 2022|
|0.3.3||Mar 29, 2022|
|0.1.7||Mar 17, 2021|
#17 in Value formatting
674 downloads per month
Used in 13 crates (6 directly)
This crate provides a fast interface to "stringify" unsigned integers, formatted with commas at each thousand. It prioritizes speed and simplicity over configurability.
If your application just wants to quickly turn
Dactyl is a great choice. If your application requires locale awareness or other options, something like
num-format would probably make more sense.
itoa, Dactyl writes ASCII conversions to a temporary buffer, but does so using fixed arrays sized for each type's maximum value, minimizing the allocation overhead for, say, tiny little
Each type has its own struct, each of which works exactly the same way:
(Note: support for
usize values is folded into [
The intended use case is to simply call the appropriate
from() for the type, then use either the
as_bytes() struct methods to retrieve the output in the desired format. Each struct also implements traits like
AsRef<[u8]>, etc., if you prefer those.
use dactyl::NiceU16; assert_eq!(NiceU16::from(11234_u16).as_str(), "11,234"); assert_eq!(NiceU16::from(11234_u16).as_bytes(), b"11,234");
dactyl to your
[dependencies] dactyl = "0.4.*"
This crate also contains a few more specialized "nice" structs:
See also: CREDITS.md
Copyright © 2023 Blobfolio, LLC <firstname.lastname@example.org>
This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <email@example.com> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO.