num-format
A Rust crate for producing string-representations of numbers, formatted according to international standards
0.4.4
66M downloads/mo
#1051 most downloaded on crates.io
bcmyers/num-format
What this package is like to depend on
Last release 4 years ago
no release in 18 months
Ships unpredictably
gaps range from 2 weeks to 3.6 years
Most releases are documented
notes for 7 of 10 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
10 releases · first in 2019
0 releases in the last 12 months
see the full history below
Release timeline
10 releases · Feb 2019 to Dec 2022Releases
latest 10-
0.4.403 Dec 2022Nothing published for this version
-
0.4.310 Oct 2022 -
0.4.209 Oct 2022Release notes
Open source →- Bump 3rd party dependencies
- Update cldr-numbers-full git submodule to commit b52a87048985d3052f12d30d05cfe5423ad92709
Locale::from_strnow supports underscore-delimited locales, e.g. "de_DE", in addition to previously supported dash-delimiated locales, e.g "de-DE"
-
0.4.020 Feb 2019Release notes
Open source →Breaking changes:
- Because
SystemLocalerequires a lot of dependencies (especially for Windows users), it's now only available behind a feature flag (with-system-locale). The upside is, of course, that those using num-format without this feature will only need to download and compile a small handful of dependencies.
- Because
-
0.3.019 Feb 2019Release notes
Open source →Breaking changes:
Environmentwas renamed toSystemLocale.ErrorandErrorKindwere refactored.- Compiling for Windows depends on bindgen and so requires Clang 3.9 or above.
Bug fixes:
- num-format now works on Windows!
Enhancements:
- Major overhaul of the code that interacts with operating systems (linux, macOS, freebsd, Windows, etc.)
- Methods
available_names,from_name, andnamewere added to bothLocaleandSystemLocale. - Several error messages now provide more detail about what exactly went wrong.
-
0.2.107 Feb 2019Release notes
Open source →Bug fixes:
WriteFormattedwas being unconditionally implemented onstd::os::unix::net::UnixStream, which is a unix-only type; so we moved this implementation behind a#[cfg(unix)]flag.
-
0.2.007 Feb 2019Release notes
Open source →Breaking changes:
-
Flatten module structure
- We decided to flatten the module structure of num-format to both improve code readabiity and to simplify the importing of types by users. Unfortunately this is a breaking change.
- The
num_format::formatandnum_format::errorsmodules have been removed and all of their containing types have been moved to the crate root. - So whereas one used to do this:
use num_format::errors::{Error, ErrorKind}; use num_format::format::{CustomFormat, Environment, Format, Locale}; use num_format::format::utils::{InfinityStr, MinusSignStr, NanStr};- one now does this:
use num_format::{CustomFormat, Environment, Error, ErrorKind, Format, Locale}; use num_format::utils::{InfinityStr, MinusSignStr, NanStr};- Thank you BurntSushi for the suggestion
-
Refactor
ErrorandErrorKind- Since the future of the failure crate
is up in the air, we decided to remove it as a dependency, refactoring
num_format::Errorandnum_format::ErrorKindto work with just plain oldstd::error::Error - Thank you BurntSushi for the suggestion
- Since the future of the failure crate
is up in the air, we decided to remove it as a dependency, refactoring
New features:
-
impl
From<Environment>andFrom<Locale>forCustomFormat- Now you can easiliy turn an
Environmentor aLocaleinto aCustomFormat; so it's easy to start with an already complete "base" format and then just tweak it slightly to the custom format you want.
use num_format::{CustomFormat, Error, Locale, ToFormattedString}; fn main() -> Result<(), Error> { let format = CustomFormat::from(Locale::en_IN) .into_builder() .separator(Some(' ')) .build()?; let s = 1_000_000.to_formatted_string(&format); assert_eq!(&s, "10 00 000"); Ok(()) } - Now you can easiliy turn an
-
-
0.1.205 Feb 2019 -
0.1.105 Feb 2019Nothing published for this version
-
0.1.005 Feb 2019Nothing published for this version