diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9c60153 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: cargo + directory: / + schedule: + interval: daily + ignore: + - dependency-name: "*" + # patch and minor updates don't matter for libraries + # remove this ignore rule if your package has binaries + update-types: + - "version-update:semver-patch" + - "version-update:semver-minor" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..61a91db --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,75 @@ +on: + push: + branches: [master] + pull_request: +name: check +jobs: + clippy: + runs-on: ${{ matrix.os }} + name: clippy / ${{ matrix.os }} / stable + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + default: true + components: clippy + - name: cargo clippy --all-features --all-targets --tests --workspace -- -D warnings + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --all-features --all-targets --tests --workspace -- -D warnings + doc: + runs-on: ${{ matrix.os }} + name: doc / ${{ matrix.os }} / stable + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + default: true + - name: cargo doc --all-features --no-deps + uses: actions-rs/cargo@v1 + with: + command: doc + args: --all-features --no-deps + env: + RUSTDOCFLAGS: --cfg docsrs + fmt: + runs-on: ${{ matrix.os }} + name: fmt / ${{ matrix.os }} / stable + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt + - name: cargo fmt --all --check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7a52478 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,108 @@ +on: + push: + branches: [master] + pull_request: +name: test +jobs: + test: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} / stable + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: cargo generate-lockfile --manifest-path num-format/Cargo.toml + if: hashFiles('Cargo.lock') == '' + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - name: cargo hack --package num-format --feature-powerset test --locked + uses: actions-rs/cargo@v1 + with: + command: hack + args: --package num-format --feature-powerset test --locked + - name: cargo hack --package num-format-benches --feature-powerset test --locked + uses: actions-rs/cargo@v1 + with: + command: hack + args: --package num-format-benches --feature-powerset test --locked + - name: cargo hack --package num-format-dev --feature-powerset test --locked + uses: actions-rs/cargo@v1 + with: + command: hack + args: --package num-format-dev --feature-powerset test --locked + test-msrv: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} / ${{ matrix.msrv }} + # we use a matrix here just because env can't be used in job names + # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability + strategy: + fail-fast: false + matrix: + msrv: [1.58.0] + os: [macos-latest, ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install ${{ matrix.msrv }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.msrv }} + default: true + - name: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: cargo generate-lockfile --manifest-path num-format/Cargo.toml + if: hashFiles('Cargo.lock') == '' + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + args: --manifest-path num-format/Cargo.toml + - name: cargo hack --package num-format --feature-powerset test --locked + uses: actions-rs/cargo@v1 + with: + command: hack + args: --package num-format --feature-powerset test --locked + test-msrv-no-default-features: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} / ${{ matrix.msrv }} + # we use a matrix here just because env can't be used in job names + # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability + strategy: + fail-fast: false + matrix: + msrv: [1.56.0] + os: [macos-latest, ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install ${{ matrix.msrv }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.msrv }} + default: true + - name: cargo generate-lockfile --manifest-path num-format/Cargo.toml + if: hashFiles('Cargo.lock') == '' + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + args: --manifest-path num-format/Cargo.toml + - name: cargo test --package num-format --no-default-features --locked + uses: actions-rs/cargo@v1 + with: + command: test + args: --package num-format --no-default-features --locked diff --git a/.gitignore b/.gitignore index 89575c8..d1e340e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ Cargo.lock .vscode/ /tmp + +**/venv/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3aac9e4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: rust -cache: cargo -git: - submodules: false -matrix: - allow_failures: - - os: windows - - rust: nightly - fast_finish: true -os: - - linux - - osx - - windows -rust: - - stable - - beta - - nightly -script: - - ./scripts/test.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c0b064..6ba2af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +0.4.3 (2022-10-09) +================== + +* Add github actions CI +* Fix a few clippy lints + +0.4.2 (2022-10-09) +================== + +* Bump 3rd party dependencies +* Update [cldr-numbers-full](https://github.com/unicode-cldr/cldr-numbers-full) + git submodule to commit [b52a87048985d3052f12d30d05cfe5423ad92709](https://github.com/unicode-cldr/cldr-numbers-full/commit/b52a87048985d3052f12d30d05cfe5423ad92709) +* `Locale::from_str` now supports underscore-delimited locales, e.g. "de_DE", + in addition to previously supported dash-delimiated locales, e.g "de-DE" + 0.4.0 (2019-02-19) ================== **Breaking changes:** diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85db16d..e318b18 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,10 +19,10 @@ problem, any possible alternatives, and any disadvantages. development, including the submodule: ```bash -$ git clone git@github.com:bcmyers/num-format.git -$ cd num-format -$ git submodule init -$ git submodule update +git clone git@github.com:bcmyers/num-format.git +cd num-format +git submodule init +git submodule update ``` ### Running the test suite @@ -34,10 +34,22 @@ tests for you. To run the full test suite: +* Install [just](https://github.com/casey/just) if it is not already installed + +```bash +cargo install just +``` + +* Install [cargo-hack](https://github.com/taiki-e/cargo-hack) if it is not already installed + +```bash +cargo install cargo-hack +``` + * Make sure you're in the root directory (the directory with the workspace Cargo.toml), and then... ```bash -$ ./scripts/test.sh +just test ``` ### num-format-dev @@ -55,7 +67,7 @@ To run num-format-dev (thereby re-creating `num-format/src/locale.rs`): * Make sure you're in the root directory (the directory with the workspace Cargo.toml), and then... ```bash -$ ./scripts/locale.sh +just locale ``` You only need to run num-format-dev if you wish to modify `num-format/src/locale.rs`. diff --git a/README.md b/README.md index 4579cba..30601af 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # num-format -[![Build Status](https://travis-ci.org/bcmyers/num-format.svg?branch=master)](https://travis-ci.org/bcmyers/num-format) [![Crates.io](https://img.shields.io/crates/v/num-format.svg)](https://crates.io/crates/num-format) [![Documentation](https://docs.rs/num-format/badge.svg)](https://docs.rs/num-format/) ![License](https://img.shields.io/crates/l/num_format.svg) @@ -123,7 +122,7 @@ OS's locale information. It has a very similar API to [`Locale`] and should work operating systems (i.e. macOS, linux, the BSDs, and Windows). Since this type requires several dependencies (especially on Windows), it is behind a feature -flag. To use it, include `num-format = { version = "0.4", features = ["with-system-locale"] }` +flag. To use it, include `num-format = { version = "0.4.3", features = ["with-system-locale"] }` in your `Cargo.toml`. Additionally, on Windows (but **only** on Windows), using `SystemLocale` requires Clang 3.9 or higher. @@ -171,7 +170,8 @@ fn main() -> Result<(), Error> { ## Requirements -* Rust 1.31 or greater +* Rust 1.56.0 or greater if compiled with `--no-default-features` +* Rust 1.58.0 or greater if compiled with default features * If you're using the `with-system-locale` feature **and** you're on Windows, Clang 3.9 or higher is also required. See [here](https://rust-lang.github.io/rust-bindgen/requirements.html) for installation instructions. @@ -180,10 +180,10 @@ fn main() -> Result<(), Error> { | Available features | What to put in your `Cargo.toml` | | :------------------- | :-------------------------------------------------------------------- | -| `no_std` | `num-format = { version = "0.4", default-features = false }` | -| `with-num-bigint` | `num-format = { version = "0.4", features = ["with-num-bigint"] }` | -| `with-serde` | `num-format = { version = "0.4", features = ["with-serde"] }` | -| `with-system-locale` | `num-format = { version = "0.4", features = ["with-system-locale"] }` | +| `no_std` | `num-format = { version = "0.4.3", default-features = false }` | +| `with-num-bigint` | `num-format = { version = "0.4.3", features = ["with-num-bigint"] }` | +| `with-serde` | `num-format = { version = "0.4.3", features = ["with-serde"] }` | +| `with-system-locale` | `num-format = { version = "0.4.3", features = ["with-system-locale"] }` | ## License @@ -195,21 +195,21 @@ fn main() -> Result<(), Error> { at your option. [bindgen]: https://crates.io/crates/bindgen -[`Buffer`]: https://docs.rs/num-format/0.4.0/num_format/struct.Buffer.html +[`Buffer`]: https://docs.rs/num-format/0.4.3/num_format/struct.Buffer.html [Common Locale Data Repository]: https://en.wikipedia.org/wiki/Common_Locale_Data_Repository -[`CustomFormat`]: https://docs.rs/num-format/0.4.0/num_format/struct.CustomFormat.html +[`CustomFormat`]: https://docs.rs/num-format/0.4.3/num_format/struct.CustomFormat.html [`File`]: https://doc.rust-lang.org/std/fs/struct.File.html [`fmt::Write`]: https://doc.rust-lang.org/std/fmt/fn.write.html -[`Format`]: https://docs.rs/num-format/0.4.0/num_format/trait.Format.html +[`Format`]: https://docs.rs/num-format/0.4.3/num_format/trait.Format.html [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html -[`Locale`]: https://docs.rs/num-format/0.4.0/num_format/enum.Locale.html +[`Locale`]: https://docs.rs/num-format/0.4.3/num_format/enum.Locale.html [`num_bigint::BigInt`]: https://docs.rs/num-bigint/0.2.2/num_bigint/struct.BigInt.html [picking a format]: #picking-a-format [`String`]: https://doc.rust-lang.org/std/string/struct.String.html [The Apache License, Version 2.0]: http://www.apache.org/licenses/LICENSE-2.0 [The MIT license]: http://opensource.org/licenses/MIT -[`ToFormattedString`]: https://docs.rs/num-format/0.4.0/num_format/trait.ToFormattedString.html -[`to_formatted_string`]: https://docs.rs/num-format/0.4.0/num_format/trait.ToFormattedString.html#method.to_formatted_string +[`ToFormattedString`]: https://docs.rs/num-format/0.4.3/num_format/trait.ToFormattedString.html +[`to_formatted_string`]: https://docs.rs/num-format/0.4.3/num_format/trait.ToFormattedString.html#method.to_formatted_string [Unicode Consortium]: https://en.wikipedia.org/wiki/Unicode_Consortium [`Vec`]: https://doc.rust-lang.org/std/vec/struct.Vec.html -[`WriteFormatted`]: https://docs.rs/num-format/0.4.0/num_format/trait.WriteFormatted.html +[`WriteFormatted`]: https://docs.rs/num-format/0.4.3/num_format/trait.WriteFormatted.html diff --git a/justfile b/justfile new file mode 100644 index 0000000..9b361de --- /dev/null +++ b/justfile @@ -0,0 +1,37 @@ +default: check + +bench: + cargo bench --manifest-path num-format-benches/Cargo.toml + +check: + cargo clippy --all-features --all-targets --tests --workspace + +clippy: check + +fmt: + cargo fmt --all + +locale: + cargo run --manifest-path num-format-dev/Cargo.toml + cargo fmt --all + +readme: + #!/usr/bin/env bash + set -euo pipefail + ( + cd num-format + cargo readme > README.md + ) + cp num-format/README.md ./README.md + ( + cd num-format-windows + cargo readme > README.md + ) + +test: + cargo fmt --all --check + cargo clippy --all-features --all-targets --tests --workspace -- -D warnings + cargo hack --package num-format --feature-powerset test + cargo hack --package num-format-benches --feature-powerset test + cargo hack --package num-format-dev --feature-powerset test + cargo hack --package num-format-windows --feature-powerset test diff --git a/num-format-benches/Cargo.toml b/num-format-benches/Cargo.toml index 3ac3e4b..ade8762 100644 --- a/num-format-benches/Cargo.toml +++ b/num-format-benches/Cargo.toml @@ -3,7 +3,7 @@ name = "num-format-benches" version = "0.1.0" authors = ["Brian Myers "] -edition = "2018" +edition = "2021" license = "MIT/Apache-2.0" publish = false @@ -11,8 +11,8 @@ publish = false num-format = { path = "../num-format" } [dev-dependencies] -criterion = "0.2" -itoa = { version = "0.4", features = ["i128"] } +criterion = "0.4.0" +itoa = { version = "1.0.4" } [[bench]] name = "bench_usize" diff --git a/num-format-benches/benches/bench_usize.rs b/num-format-benches/benches/bench_usize.rs index 4e06d13..8d66bf8 100644 --- a/num-format-benches/benches/bench_usize.rs +++ b/num-format-benches/benches/bench_usize.rs @@ -2,88 +2,63 @@ use std::time::Duration; -use criterion::{criterion_group, criterion_main, Benchmark, Criterion}; +use criterion::{criterion_group, criterion_main, Criterion}; use num_format::{Buffer, Locale, ToFormattedString, WriteFormatted}; fn bench_usize(c: &mut Criterion) { let measurement_time = Duration::from_millis(5_000); // Default is 5 seconds let sample_size = 100; // Default is 100 let warm_up_time = Duration::from_millis(3_000); // Default is 3 seconds + let mut group = c.benchmark_group("usize"); - c.bench( - "usize", - Benchmark::new("std/to_string/10_000", |b| { - b.iter(|| { - let s = 10_000usize.to_string(); - }) + group.bench_function("std/to_string/10_000", |b| { + b.iter(|| { + let s = 10_000usize.to_string(); }) - .with_function("itoa/buffer/10_000", |b| { - b.iter(|| { - let mut bytes = [b'\0'; 40]; - let n = itoa::write(&mut bytes[..], 10_000usize).unwrap(); - }) + }); + group.bench_function("num-format/buffer/10_000", |b| { + b.iter(|| { + let mut buf = Buffer::default(); + buf.write_formatted(&10_000usize, &Locale::en); }) - .with_function("itoa/write/10_000", |b| { - let mut s = String::new(); - b.iter(|| { - itoa::fmt(&mut s, 10_000usize).unwrap(); - }) + }); + group.bench_function("num-format/write/10_000", |b| { + let mut s = String::new(); + b.iter(|| { + s.write_formatted(&10_000usize, &Locale::en).unwrap(); }) - .with_function("num-format/buffer/10_000", |b| { - b.iter(|| { - let mut buf = Buffer::default(); - buf.write_formatted(&10_000usize, &Locale::en); - }) + }); + group.bench_function("num-format/to_string/10_000", |b| { + b.iter(|| { + let s = 10_000usize.to_formatted_string(&Locale::en); }) - .with_function("num-format/write/10_000", |b| { - let mut s = String::new(); - b.iter(|| { - s.write_formatted(&10_000usize, &Locale::en).unwrap(); - }) + }); + group.bench_function("std/to_string/MAX", |b| { + b.iter(|| { + let s = std::usize::MAX.to_string(); }) - .with_function("num-format/to_string/10_000", |b| { - b.iter(|| { - let s = 10_000usize.to_formatted_string(&Locale::en); - }) + }); + group.bench_function("num-format/buffer/MAX", |b| { + b.iter(|| { + let mut buf = Buffer::default(); + buf.write_formatted(&std::usize::MAX, &Locale::en); }) - .with_function("std/to_string/MAX", |b| { - b.iter(|| { - let s = std::usize::MAX.to_string(); - }) + }); + group.bench_function("num-format/write/MAX", |b| { + let mut s = String::new(); + b.iter(|| { + s.write_formatted(&std::usize::MAX, &Locale::en).unwrap(); }) - .with_function("itoa/buffer/MAX", |b| { - b.iter(|| { - let mut bytes = [b'\0'; 40]; - let n = itoa::write(&mut bytes[..], std::usize::MAX).unwrap(); - }) + }); + group.bench_function("num-format/to_string/MAX", |b| { + b.iter(|| { + let s = std::usize::MAX.to_formatted_string(&Locale::en); }) - .with_function("itoa/write/MAX", |b| { - let mut s = String::new(); - b.iter(|| { - itoa::fmt(&mut s, std::usize::MAX).unwrap(); - }) - }) - .with_function("num-format/buffer/MAX", |b| { - b.iter(|| { - let mut buf = Buffer::default(); - buf.write_formatted(&std::usize::MAX, &Locale::en); - }) - }) - .with_function("num-format/write/MAX", |b| { - let mut s = String::new(); - b.iter(|| { - s.write_formatted(&std::usize::MAX, &Locale::en).unwrap(); - }) - }) - .with_function("num-format/to_string/MAX", |b| { - b.iter(|| { - let s = std::usize::MAX.to_formatted_string(&Locale::en); - }) - }) - .measurement_time(measurement_time) - .sample_size(sample_size) - .warm_up_time(warm_up_time), - ); + }); + group.measurement_time(measurement_time); + group.sample_size(sample_size); + group.warm_up_time(warm_up_time); + group.finish(); } criterion_group! { diff --git a/num-format-benches/python/bench.py b/num-format-benches/python/bench.py new file mode 100644 index 0000000..705d99a --- /dev/null +++ b/num-format-benches/python/bench.py @@ -0,0 +1,14 @@ +import perf + +def one_million(): + "{:,}".format(1_000_000) + +def main(): + runner = perf.Runner() + runner.timeit("one_million", + "one_million()", + "from __main__ import one_million", + inner_loops=10) + +if __name__ == "__main__": + main() diff --git a/num-format-dev/Cargo.toml b/num-format-dev/Cargo.toml index 80aff04..4f09264 100644 --- a/num-format-dev/Cargo.toml +++ b/num-format-dev/Cargo.toml @@ -3,19 +3,15 @@ name = "num-format-dev" version = "0.1.0" authors = ["Brian Myers "] -edition = "2018" +edition = "2021" license = "MIT/Apache-2.0" publish = false [dependencies] -failure = "0.1" -indexmap = "1.0" -proc-macro2 = "0.4" -quote = "0.6" -rustfmt-nightly = { version = "1.0", optional = true } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -walkdir = "2.2" - -[features] -nightly = ["rustfmt-nightly"] +anyhow = "1.0.65" +indexmap = "1.9.1" +proc-macro2 = "1.0.46" +quote = "1.0.21" +serde = { version = "1.0.145", features = ["derive"] } +serde_json = "1.0.85" +walkdir = "2.3.2" diff --git a/num-format-dev/cldr-numbers-full b/num-format-dev/cldr-numbers-full index 48692af..b52a870 160000 --- a/num-format-dev/cldr-numbers-full +++ b/num-format-dev/cldr-numbers-full @@ -1 +1 @@ -Subproject commit 48692afe28c61c5b3a475d7aead86ab04e9c5f09 +Subproject commit b52a87048985d3052f12d30d05cfe5423ad92709 diff --git a/num-format-dev/src/create_module.rs b/num-format-dev/src/create_module.rs index 33f515f..085c717 100644 --- a/num-format-dev/src/create_module.rs +++ b/num-format-dev/src/create_module.rs @@ -2,27 +2,10 @@ use indexmap::IndexMap; use proc_macro2::{Delimiter, Group, Ident, Literal, Span}; use quote::quote; -#[cfg(feature = "nightly")] -use crate::rustfmt::rustfmt; use crate::utils::Format; -#[cfg(feature = "nightly")] /// Takes the map returned from `parse_data` and turns it into a rust module. -pub fn create_module(data: &IndexMap) -> Result { - let s = _create_module(data)?; - let s = rustfmt(s)?; - Ok(s) -} - -#[cfg(not(feature = "nightly"))] -/// Takes the map returned from `parse_data` and turns it into a rust module. -pub fn create_module(data: &IndexMap) -> Result { - let s = _create_module(data)?; - Ok(s) -} - -/// Takes the map returned from `parse_data` and turns it into a rust module. -fn _create_module(data: &IndexMap) -> Result { +pub fn create_module(data: &IndexMap) -> Result { let variant_names = data.keys().map(|s| Ident::new(s, Span::call_site())); let mut decimals = Vec::new(); @@ -118,6 +101,17 @@ fn _create_module(data: &IndexMap) -> Result #value, + }, + ); + from_strs.push(group); + } // names let value = Literal::string(&format.identifier); @@ -149,7 +143,7 @@ fn _create_module(data: &IndexMap) -> ResultA key type. Represents formats from the [Unicode Consortium]'s ///[Common Locale Data Repository (CLDR)]. Implements [`Format`]. diff --git a/num-format-dev/src/lib.rs b/num-format-dev/src/lib.rs index 84a3242..83514d0 100644 --- a/num-format-dev/src/lib.rs +++ b/num-format-dev/src/lib.rs @@ -1,29 +1,23 @@ //! Utility crate for programmatically generating a rust module / enum from CLDR json files. -#![deny(dead_code)] -#![deny(deprecated)] -#![deny(missing_copy_implementations)] -#![deny(missing_debug_implementations)] -#![deny(missing_docs)] -#![deny(trivial_casts)] -#![deny(trivial_numeric_casts)] -#![deny(unused_extern_crates)] -#![deny(unused_imports)] -#![deny(unused_macros)] -#![deny(unused_mut)] -#![deny(unused_results)] -#![deny(unused_parens)] -#![deny(unused_unsafe)] -#![deny(unused_variables)] +#![deny( + dead_code, + deprecated, + future_incompatible, + missing_copy_implementations, + missing_debug_implementations, + missing_docs, + nonstandard_style, + rust_2018_idioms, + trivial_casts, + trivial_numeric_casts, + unused +)] #![recursion_limit = "256"] mod create_module; mod parse_data; -#[cfg(feature = "nightly")] -mod rustfmt; mod utils; pub use self::create_module::create_module; pub use self::parse_data::parse_data; -#[cfg(feature = "nightly")] -pub use self::rustfmt::rustfmt; diff --git a/num-format-dev/src/main.rs b/num-format-dev/src/main.rs index aecbcb2..fa5e835 100644 --- a/num-format-dev/src/main.rs +++ b/num-format-dev/src/main.rs @@ -6,7 +6,7 @@ use num_format_dev::{create_module, parse_data}; const DATA_DIR: &str = "./num-format-dev/cldr-numbers-full"; const OUT_PATH: &str = "./num-format/src/locale.rs"; -fn main() -> Result<(), failure::Error> { +fn main() -> Result<(), anyhow::Error> { let data = parse_data(DATA_DIR)?; let s = create_module(&data)?; let mut f = File::create(OUT_PATH)?; diff --git a/num-format-dev/src/parse_data.rs b/num-format-dev/src/parse_data.rs index 80e5d7f..ca6f856 100644 --- a/num-format-dev/src/parse_data.rs +++ b/num-format-dev/src/parse_data.rs @@ -4,7 +4,6 @@ use std::path::Path; use indexmap::IndexMap; use serde::Deserialize; -use serde_json; use walkdir::WalkDir; use crate::utils::{Format, Grouping}; @@ -13,7 +12,7 @@ const MAX_MIN_LEN: usize = 8; const MAX_POS_LEN: usize = 8; /// Walks a directory containing CLDR json files and collects the data they contain into a map. -pub fn parse_data

(data_dir: P) -> Result, failure::Error> +pub fn parse_data

(data_dir: P) -> Result, anyhow::Error> where P: AsRef, { @@ -51,7 +50,7 @@ where &value["numbers"]["defaultNumberingSystem"].as_str().unwrap(); let symbols_lookup = format!("symbols-numberSystem-{}", default_numbering_system); let symbols = &value["numbers"][&symbols_lookup].to_string(); - let symbols: Symbols = serde_json::from_str(&symbols).unwrap(); + let symbols: Symbols = serde_json::from_str(symbols).unwrap(); // Grouping let decimal_formats_lookup = diff --git a/num-format-dev/src/rustfmt.rs b/num-format-dev/src/rustfmt.rs deleted file mode 100644 index e07a36a..0000000 --- a/num-format-dev/src/rustfmt.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![cfg(feature = "nightly")] - -use rustfmt_nightly::{Config, Edition, EmitMode, Input, Session}; - -/// Programmatically runs rustfmt on a `String`. -pub fn rustfmt(module: S) -> Result -where - S: Into, -{ - let input = Input::Text(module.into()); - - let mut config = Config::default(); - config.set().edition(Edition::Edition2018); - config.set().emit_mode(EmitMode::Stdout); - // config.set().max_width(200); - - let mut output = Vec::new(); - { - let mut session = Session::new(config, Some(&mut output)); - let _format_report = session.format(input)?; - } - let s = String::from_utf8(output)?; - Ok(s) -} diff --git a/num-format-dev/src/utils/grouping.rs b/num-format-dev/src/utils/grouping.rs index 67f0d13..645ac08 100644 --- a/num-format-dev/src/utils/grouping.rs +++ b/num-format-dev/src/utils/grouping.rs @@ -11,7 +11,7 @@ pub enum Grouping { } impl Grouping { - pub(crate) fn to_ident(&self) -> Ident { + pub(crate) fn to_ident(self) -> Ident { match self { Grouping::Indian => Ident::new("Indian", Span::call_site()), Grouping::Standard => Ident::new("Standard", Span::call_site()), @@ -21,7 +21,7 @@ impl Grouping { } impl fmt::Display for Grouping { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let s = match self { Grouping::Indian => "#,##,##0.###", Grouping::Standard => "#,##0.###", @@ -32,14 +32,14 @@ impl fmt::Display for Grouping { } impl FromStr for Grouping { - type Err = failure::Error; + type Err = anyhow::Error; fn from_str(s: &str) -> Result { let format = match s { "#,##0.###" => Grouping::Standard, "0.######" => Grouping::Posix, "#,##,##0.###" => Grouping::Indian, - _ => return Err(failure::format_err!("Could not parse {} into Grouping", s)), + _ => anyhow::bail!("Could not parse {} into Grouping", s), }; Ok(format) } diff --git a/num-format-windows/Cargo.toml b/num-format-windows/Cargo.toml index 4147f7d..6214ed4 100644 --- a/num-format-windows/Cargo.toml +++ b/num-format-windows/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "num-format-windows" -version = "0.3.0" # Remember to keep html_root_url in lib.rs in sync! +version = "0.4.4" # Remember to keep html_root_url in lib.rs in sync! authors = ["Brian Myers "] categories = [] description = "A helper crate for num-format. Do not use directly." documentation = "https://docs.rs/num-format-windows" -edition = "2018" +edition = "2021" homepage = "https://github.com/bcmyers/num-format/num-format-windows" keywords = [] license = "MIT/Apache-2.0" @@ -18,4 +18,4 @@ build = "build.rs" include = ["build.rs", "Cargo.toml", "src/**/*", "wrapper.h"] [build-dependencies] -bindgen = "0.47" +bindgen = "0.63.0" diff --git a/num-format-windows/build.rs b/num-format-windows/build.rs index 0713871..3308b81 100644 --- a/num-format-windows/build.rs +++ b/num-format-windows/build.rs @@ -11,18 +11,18 @@ fn main() { let bindings = Builder::default() .header(headers) - .rust_target(RustTarget::Stable_1_28) - .whitelist_var("LOCALE_NAME_MAX_LENGTH") - .whitelist_var("LOCALE_NAME_SYSTEM_DEFAULT") - .whitelist_var("LOCALE_SDECIMAL") - .whitelist_var("LOCALE_SGROUPING") - .whitelist_var("LOCALE_SNAME") - .whitelist_var("LOCALE_SNAN") - .whitelist_var("LOCALE_SNEGATIVESIGN") - .whitelist_var("LOCALE_SNEGINFINITY") - .whitelist_var("LOCALE_SPOSINFINITY") - .whitelist_var("LOCALE_SPOSITIVESIGN") - .whitelist_var("LOCALE_STHOUSAND") + .rust_target(RustTarget::Stable_1_33) + .allowlist_var("LOCALE_NAME_MAX_LENGTH") + .allowlist_var("LOCALE_NAME_SYSTEM_DEFAULT") + .allowlist_var("LOCALE_SDECIMAL") + .allowlist_var("LOCALE_SGROUPING") + .allowlist_var("LOCALE_SNAME") + .allowlist_var("LOCALE_SNAN") + .allowlist_var("LOCALE_SNEGATIVESIGN") + .allowlist_var("LOCALE_SNEGINFINITY") + .allowlist_var("LOCALE_SPOSINFINITY") + .allowlist_var("LOCALE_SPOSITIVESIGN") + .allowlist_var("LOCALE_STHOUSAND") .generate() .expect("unable to generate bindings for windows.h"); diff --git a/num-format-windows/src/lib.rs b/num-format-windows/src/lib.rs index 0c18cbe..b9af09e 100644 --- a/num-format-windows/src/lib.rs +++ b/num-format-windows/src/lib.rs @@ -11,7 +11,7 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] -#![doc(html_root_url = "https://docs.rs/num-format-windows/0.3.0")] +#![doc(html_root_url = "https://docs.rs/num-format-windows/0.4.4")] #[cfg(windows)] include!(concat!(env!("OUT_DIR"), "\\bindings.rs")); diff --git a/num-format/Cargo.toml b/num-format/Cargo.toml index 8afdf67..cdc2eef 100644 --- a/num-format/Cargo.toml +++ b/num-format/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "num-format" -version = "0.4.0" # Remember to keep html_root_url in lib.rs in sync! +version = "0.4.4" # Remember to keep html_root_url in lib.rs in sync! authors = ["Brian Myers "] categories = ["encoding", "internationalization", "localization", "no-std", "value-formatting"] description = "A Rust crate for producing string-representations of numbers, formatted according to international standards" documentation = "https://docs.rs/num-format" -edition = "2018" +edition = "2021" homepage = "https://github.com/bcmyers/num-format" keywords = ["comma", "internationalization", "number", "separator", "thousands"] license = "MIT/Apache-2.0" @@ -14,36 +14,32 @@ publish = true readme = "README.md" repository = "https://github.com/bcmyers/num-format" -[badges] -maintenance = { status = "actively-developed" } -travis-ci = { repository = "bcmyers/num-format", branch = "master" } - [dependencies] -arrayvec = { version = "0.4", default-features = false } -itoa = { version = "0.4", default-features = false, features = ["i128"] } -lazy_static = { version = "1.2", optional = true } -num-bigint = { version = "0.2", optional = true } -serde = { version = "1.0", default-features = false, optional = true } +arrayvec = { version = "0.7.2", default-features = false } +itoa = { version = "1.0.4", default-features = false } +lazy_static = { version = "1.4.0", optional = true } +num-bigint = { version = "0.4.3", optional = true } +serde = { version = "1.0.145", default-features = false, optional = true } [target.'cfg(unix)'.dependencies] -cfg-if = { version = "0.1", optional = true } -encoding_rs = { version = "0.8", optional = true } -libc = { version = "0.2", optional = true } +cfg-if = { version = "1.0.0", optional = true } +encoding_rs = { version = "0.8.31", optional = true } +libc = { version = "0.2.134", optional = true } [target.'cfg(windows)'.dependencies] -num-format-windows = { version = "0.3", optional = true } -widestring = { version = "0.4", optional = true } -winapi = { version = "0.3", features = ["winnls"], optional = true } +num-format-windows = { version = "0.4.4", optional = true } +widestring = { version = "1.0.2", optional = true } +winapi = { version = "0.3.9", features = ["winnls"], optional = true } [features] default = ["std"] -std = ["arrayvec/default", "itoa/default", "itoa/i128"] -with-serde = ["arrayvec/serde-1", "serde/derive"] +std = ["arrayvec/default"] +with-serde = ["arrayvec/serde", "serde/derive"] with-system-locale = ["cfg-if", "encoding_rs", "lazy_static", "libc", "num-format-windows", "std", "widestring", "winapi/winnls"] with-num-bigint = ["num-bigint", "std"] [dev-dependencies] -cfg-if = "0.1" -lazy_static = "1.2" -rand = "0.6" -serde_json = "1.0" +cfg-if = "1.0.0" +lazy_static = "1.4.0" +rand = "0.8.5" +serde_json = "1.0.85" diff --git a/num-format/README.md b/num-format/README.md index 4579cba..30601af 100644 --- a/num-format/README.md +++ b/num-format/README.md @@ -1,6 +1,5 @@ # num-format -[![Build Status](https://travis-ci.org/bcmyers/num-format.svg?branch=master)](https://travis-ci.org/bcmyers/num-format) [![Crates.io](https://img.shields.io/crates/v/num-format.svg)](https://crates.io/crates/num-format) [![Documentation](https://docs.rs/num-format/badge.svg)](https://docs.rs/num-format/) ![License](https://img.shields.io/crates/l/num_format.svg) @@ -123,7 +122,7 @@ OS's locale information. It has a very similar API to [`Locale`] and should work operating systems (i.e. macOS, linux, the BSDs, and Windows). Since this type requires several dependencies (especially on Windows), it is behind a feature -flag. To use it, include `num-format = { version = "0.4", features = ["with-system-locale"] }` +flag. To use it, include `num-format = { version = "0.4.3", features = ["with-system-locale"] }` in your `Cargo.toml`. Additionally, on Windows (but **only** on Windows), using `SystemLocale` requires Clang 3.9 or higher. @@ -171,7 +170,8 @@ fn main() -> Result<(), Error> { ## Requirements -* Rust 1.31 or greater +* Rust 1.56.0 or greater if compiled with `--no-default-features` +* Rust 1.58.0 or greater if compiled with default features * If you're using the `with-system-locale` feature **and** you're on Windows, Clang 3.9 or higher is also required. See [here](https://rust-lang.github.io/rust-bindgen/requirements.html) for installation instructions. @@ -180,10 +180,10 @@ fn main() -> Result<(), Error> { | Available features | What to put in your `Cargo.toml` | | :------------------- | :-------------------------------------------------------------------- | -| `no_std` | `num-format = { version = "0.4", default-features = false }` | -| `with-num-bigint` | `num-format = { version = "0.4", features = ["with-num-bigint"] }` | -| `with-serde` | `num-format = { version = "0.4", features = ["with-serde"] }` | -| `with-system-locale` | `num-format = { version = "0.4", features = ["with-system-locale"] }` | +| `no_std` | `num-format = { version = "0.4.3", default-features = false }` | +| `with-num-bigint` | `num-format = { version = "0.4.3", features = ["with-num-bigint"] }` | +| `with-serde` | `num-format = { version = "0.4.3", features = ["with-serde"] }` | +| `with-system-locale` | `num-format = { version = "0.4.3", features = ["with-system-locale"] }` | ## License @@ -195,21 +195,21 @@ fn main() -> Result<(), Error> { at your option. [bindgen]: https://crates.io/crates/bindgen -[`Buffer`]: https://docs.rs/num-format/0.4.0/num_format/struct.Buffer.html +[`Buffer`]: https://docs.rs/num-format/0.4.3/num_format/struct.Buffer.html [Common Locale Data Repository]: https://en.wikipedia.org/wiki/Common_Locale_Data_Repository -[`CustomFormat`]: https://docs.rs/num-format/0.4.0/num_format/struct.CustomFormat.html +[`CustomFormat`]: https://docs.rs/num-format/0.4.3/num_format/struct.CustomFormat.html [`File`]: https://doc.rust-lang.org/std/fs/struct.File.html [`fmt::Write`]: https://doc.rust-lang.org/std/fmt/fn.write.html -[`Format`]: https://docs.rs/num-format/0.4.0/num_format/trait.Format.html +[`Format`]: https://docs.rs/num-format/0.4.3/num_format/trait.Format.html [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html -[`Locale`]: https://docs.rs/num-format/0.4.0/num_format/enum.Locale.html +[`Locale`]: https://docs.rs/num-format/0.4.3/num_format/enum.Locale.html [`num_bigint::BigInt`]: https://docs.rs/num-bigint/0.2.2/num_bigint/struct.BigInt.html [picking a format]: #picking-a-format [`String`]: https://doc.rust-lang.org/std/string/struct.String.html [The Apache License, Version 2.0]: http://www.apache.org/licenses/LICENSE-2.0 [The MIT license]: http://opensource.org/licenses/MIT -[`ToFormattedString`]: https://docs.rs/num-format/0.4.0/num_format/trait.ToFormattedString.html -[`to_formatted_string`]: https://docs.rs/num-format/0.4.0/num_format/trait.ToFormattedString.html#method.to_formatted_string +[`ToFormattedString`]: https://docs.rs/num-format/0.4.3/num_format/trait.ToFormattedString.html +[`to_formatted_string`]: https://docs.rs/num-format/0.4.3/num_format/trait.ToFormattedString.html#method.to_formatted_string [Unicode Consortium]: https://en.wikipedia.org/wiki/Unicode_Consortium [`Vec`]: https://doc.rust-lang.org/std/vec/struct.Vec.html -[`WriteFormatted`]: https://docs.rs/num-format/0.4.0/num_format/trait.WriteFormatted.html +[`WriteFormatted`]: https://docs.rs/num-format/0.4.3/num_format/trait.WriteFormatted.html diff --git a/num-format/src/buffer.rs b/num-format/src/buffer.rs index 6f25a22..c600d35 100644 --- a/num-format/src/buffer.rs +++ b/num-format/src/buffer.rs @@ -1,6 +1,5 @@ use core::borrow::Borrow; use core::fmt; -use core::mem; use core::ops::Deref; use core::str; @@ -27,6 +26,10 @@ use crate::to_formatted_str::ToFormattedStr; /// /// // Do what you want with the &str... /// assert_eq!("1,000,000", s); +/// +/// // No need to clear the buffer before further calls to `write_formatted`... +/// buf.write_formatted(&1000000, &Locale::fr); +/// assert_eq!("1\u{202f}000\u{202f}000", buf.as_str()); /// } /// ``` #[derive(Copy, Clone)] @@ -41,7 +44,7 @@ impl Buffer { #[inline(always)] pub fn new() -> Buffer { Buffer { - inner: unsafe { mem::uninitialized() }, + inner: [0; MAX_BUF_LEN], pos: MAX_BUF_LEN, end: MAX_BUF_LEN, } @@ -118,7 +121,7 @@ impl Borrow for Buffer { } impl fmt::Debug for Buffer { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.as_str()) } } @@ -143,7 +146,7 @@ impl Deref for Buffer { } impl fmt::Display for Buffer { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.as_str()) } } @@ -173,7 +176,7 @@ mod serialization { impl<'de> de::Visitor<'de> for BufferVisitor { type Value = Buffer; - fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "bytes of maximum length {}", MAX_BUF_LEN) } @@ -181,7 +184,7 @@ mod serialization { where V: de::SeqAccess<'de>, { - let mut inner: [u8; MAX_BUF_LEN] = unsafe { mem::uninitialized() }; + let mut inner: [u8; MAX_BUF_LEN] = [0; MAX_BUF_LEN]; let mut index = 0; while let Some(value) = seq.next_element()? { if index < MAX_BUF_LEN { @@ -228,7 +231,7 @@ mod serialization { assert_eq!("1,000", buf.as_str()); // should fail - let mut should_fail = ArrayString::<[u8; 1024]>::new(); + let mut should_fail = ArrayString::<1024>::new(); should_fail.push_str("[0"); for _ in 0..MAX_BUF_LEN { should_fail.push_str(",0"); diff --git a/num-format/src/constants.rs b/num-format/src/constants.rs index c35db6a..64c0474 100644 --- a/num-format/src/constants.rs +++ b/num-format/src/constants.rs @@ -12,3 +12,17 @@ pub(crate) const TABLE: &[u8] = b"\ 4041424344454647484950515253545556575859\ 6061626364656667686970717273747576777879\ 8081828384858687888990919293949596979899"; + +pub(crate) const U8_MAX_LEN: usize = 3; +pub(crate) const U16_MAX_LEN: usize = 5; +pub(crate) const U32_MAX_LEN: usize = 10; +pub(crate) const USIZE_MAX_LEN: usize = 20; +pub(crate) const U64_MAX_LEN: usize = 20; +pub(crate) const U128_MAX_LEN: usize = 39; + +pub(crate) const I8_MAX_LEN: usize = 4; +pub(crate) const I16_MAX_LEN: usize = 6; +pub(crate) const I32_MAX_LEN: usize = 11; +pub(crate) const ISIZE_MAX_LEN: usize = 20; +pub(crate) const I64_MAX_LEN: usize = 20; +pub(crate) const I128_MAX_LEN: usize = 40; diff --git a/num-format/src/error.rs b/num-format/src/error.rs index e07e94d..4501391 100644 --- a/num-format/src/error.rs +++ b/num-format/src/error.rs @@ -71,6 +71,21 @@ impl Error { }; } + pub(crate) fn parse_number(input: S) -> Error + where + S: AsRef, + { + #[cfg(feature = "std")] + return Error { + kind: ErrorKind::ParseNumber(input.as_ref().into()), + }; + + #[cfg(not(feature = "std"))] + return Error { + kind: ErrorKind::ParseNumber(ErrString::truncated(input.as_ref()).into()), + }; + } + #[cfg(all(feature = "with-system-locale", any(unix, windows)))] pub(crate) fn system_invalid_return(function_name: S, message: T) -> Error where @@ -107,7 +122,7 @@ impl Error { } impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.kind) } } diff --git a/num-format/src/error_kind.rs b/num-format/src/error_kind.rs index 2c93be6..edc9e7b 100644 --- a/num-format/src/error_kind.rs +++ b/num-format/src/error_kind.rs @@ -8,6 +8,7 @@ use crate::strings::MAX_ERR_LEN; /// This crate's error kind. #[derive(Clone, Debug, Eq, PartialEq, Hash)] +#[allow(missing_copy_implementations)] #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] pub enum ErrorKind { /// Input exceeds buffer capacity. @@ -28,7 +29,7 @@ pub enum ErrorKind { #[cfg(not(feature = "std"))] /// Other miscellaneous error. - Other(ArrayString<[u8; MAX_ERR_LEN]>), + Other(ArrayString), #[cfg(feature = "std")] /// Failed to parse input into a valid locale. @@ -36,7 +37,15 @@ pub enum ErrorKind { #[cfg(not(feature = "std"))] /// Failed to parse input into a valid locale. - ParseLocale(ArrayString<[u8; MAX_ERR_LEN]>), + ParseLocale(ArrayString), + + #[cfg(feature = "std")] + /// Failed to parse input into a number. + ParseNumber(String), + + #[cfg(not(feature = "std"))] + /// Failed to parse input into a number. + ParseNumber(ArrayString), #[cfg(all(feature = "with-system-locale", any(unix, windows)))] /// Call to C standard library or Windows API unexpectedly returned invalid data. @@ -58,7 +67,7 @@ pub enum ErrorKind { } impl fmt::Display for ErrorKind { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use self::ErrorKind::*; match self { Capacity { len, cap } => write!( @@ -79,6 +88,8 @@ impl fmt::Display for ErrorKind { ParseLocale(ref input) => write!(f, "Failed to parse {} into a valid locale.", input), + ParseNumber(ref input) => write!(f, "Failed to parse {} into a number.", input), + #[cfg(all(feature = "with-system-locale", any(unix, windows)))] SystemInvalidReturn { message, .. } => write!(f, "{}", message), diff --git a/num-format/src/format.rs b/num-format/src/format.rs index 2281ee6..6c8a855 100644 --- a/num-format/src/format.rs +++ b/num-format/src/format.rs @@ -1,11 +1,10 @@ use crate::strings::{DecimalStr, InfinityStr, MinusSignStr, NanStr, PlusSignStr, SeparatorStr}; use crate::Grouping; -/// Trait that abstracts over [`CustomFormat`], [`Locale`], and [`SystemLocale`]. +/// Trait that abstracts over [`CustomFormat`], [`Locale`], and `SystemLocale`. /// /// [`CustomFormat`]: struct.CustomFormat.html /// [`Locale`]: enum.Locale.html -/// [`SystemLocale`]: struct.SystemLocale.html pub trait Format { /// Returns the string representation of a decimal point. fn decimal(&self) -> DecimalStr<'_>; diff --git a/num-format/src/impls.rs b/num-format/src/impls.rs index fe1157d..08caf33 100644 --- a/num-format/src/impls.rs +++ b/num-format/src/impls.rs @@ -1,3 +1,3 @@ mod integers; #[cfg(feature = "with-num-bigint")] -mod num_bigint; +mod num; diff --git a/num-format/src/impls/integers.rs b/num-format/src/impls/integers.rs index 8725f83..64c273e 100644 --- a/num-format/src/impls/integers.rs +++ b/num-format/src/impls/integers.rs @@ -5,7 +5,7 @@ use core::num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZ use core::ptr; use crate::buffer::Buffer; -use crate::constants::{MAX_BUF_LEN, TABLE}; +use crate::constants::*; use crate::format::Format; use crate::grouping::Grouping; use crate::sealed::Sealed; @@ -25,7 +25,7 @@ impl ToFormattedStr for u8 { } macro_rules! impl_unsigned { - ($type:ty) => { + ($type:ty, $max_len:expr) => { impl ToFormattedStr for $type { #[doc(hidden)] #[inline(always)] @@ -40,11 +40,11 @@ macro_rules! impl_unsigned { }; } -impl_unsigned!(u16); -impl_unsigned!(u32); -impl_unsigned!(usize); -impl_unsigned!(u64); -impl_unsigned!(u128); +impl_unsigned!(u16, U16_MAX_LEN); +impl_unsigned!(u32, U32_MAX_LEN); +impl_unsigned!(usize, USIZE_MAX_LEN); +impl_unsigned!(u64, U64_MAX_LEN); +impl_unsigned!(u128, U128_MAX_LEN); impl Sealed for u8 {} impl Sealed for u16 {} @@ -56,7 +56,7 @@ impl Sealed for u128 {} // signed integers macro_rules! impl_signed { - ($type:ty) => { + ($type:ty, $max_len:expr) => { impl ToFormattedStr for $type { #[doc(hidden)] #[inline(always)] @@ -84,12 +84,12 @@ macro_rules! impl_signed { }; } -impl_signed!(i8); -impl_signed!(i16); -impl_signed!(i32); -impl_signed!(isize); -impl_signed!(i64); -impl_signed!(i128); +impl_signed!(i8, I8_MAX_LEN); +impl_signed!(i16, I16_MAX_LEN); +impl_signed!(i32, I32_MAX_LEN); +impl_signed!(isize, ISIZE_MAX_LEN); +impl_signed!(i64, I64_MAX_LEN); +impl_signed!(i128, I128_MAX_LEN); impl Sealed for i8 {} impl Sealed for i16 {} @@ -112,7 +112,7 @@ impl ToFormattedStr for NonZeroU8 { } macro_rules! impl_non_zero { - ($type:ty) => { + ($type:ty, $related_type:ty, $max_len:expr) => { impl ToFormattedStr for $type { #[doc(hidden)] #[inline(always)] @@ -127,11 +127,11 @@ macro_rules! impl_non_zero { }; } -impl_non_zero!(NonZeroU16); -impl_non_zero!(NonZeroU32); -impl_non_zero!(NonZeroUsize); -impl_non_zero!(NonZeroU64); -impl_non_zero!(NonZeroU128); +impl_non_zero!(NonZeroU16, u16, U16_MAX_LEN); +impl_non_zero!(NonZeroU32, u32, U32_MAX_LEN); +impl_non_zero!(NonZeroUsize, usize, USIZE_MAX_LEN); +impl_non_zero!(NonZeroU64, u64, U64_MAX_LEN); +impl_non_zero!(NonZeroU128, u128, U128_MAX_LEN); impl Sealed for NonZeroU8 {} impl Sealed for NonZeroU16 {} @@ -207,7 +207,7 @@ struct Sep<'a> { } #[inline(always)] -fn write_one_byte(buf: &mut Buffer, sep: &mut Sep, table_index: isize) { +fn write_one_byte(buf: &mut Buffer, sep: &mut Sep<'_>, table_index: isize) { buf.pos -= 1; if sep.pos == (buf.pos as isize) { buf.pos -= sep.len - 1; @@ -225,7 +225,7 @@ fn write_one_byte(buf: &mut Buffer, sep: &mut Sep, table_index: isize) { } #[inline(always)] -fn write_two_bytes(buf: &mut Buffer, sep: &mut Sep, table_index: isize) { +fn write_two_bytes(buf: &mut Buffer, sep: &mut Sep<'_>, table_index: isize) { write_one_byte(buf, sep, table_index + 1); write_one_byte(buf, sep, table_index); } diff --git a/num-format/src/impls/num_bigint.rs b/num-format/src/impls/num.rs similarity index 97% rename from num-format/src/impls/num_bigint.rs rename to num-format/src/impls/num.rs index 2ae9d6d..568b103 100644 --- a/num-format/src/impls/num_bigint.rs +++ b/num-format/src/impls/num.rs @@ -126,8 +126,7 @@ where let mut bytes_written = 0; let mut digits_remaining = s.len(); - let mut iter = s.as_bytes().iter(); - while let Some(digit) = iter.next() { + for digit in s.as_bytes().iter() { if bytes_written == sep_next { w.write_all(sep_bytes)?; bytes_written += sep_len; @@ -188,8 +187,7 @@ where let mut bytes_written = 0; let mut chars_written = 0; let mut digits_remaining = s.len(); - let mut iter = s.chars(); - while let Some(c) = iter.next() { + for c in s.chars() { if chars_written == sep_next { w.write_str(separator)?; bytes_written += sep_len; diff --git a/num-format/src/lib.rs b/num-format/src/lib.rs index a9cf108..9af6067 100644 --- a/num-format/src/lib.rs +++ b/num-format/src/lib.rs @@ -1,5 +1,4 @@ /*! -[![Build Status](https://travis-ci.org/bcmyers/num-format.svg?branch=master)](https://travis-ci.org/bcmyers/num-format) [![Crates.io](https://img.shields.io/crates/v/num-format.svg)](https://crates.io/crates/num-format) [![Documentation](https://docs.rs/num-format/badge.svg)](https://docs.rs/num-format/) ![License](https://img.shields.io/crates/l/num_format.svg) @@ -126,7 +125,7 @@ OS's locale information. It has a very similar API to [`Locale`] and should work operating systems (i.e. macOS, linux, the BSDs, and Windows). Since this type requires several dependencies (especially on Windows), it is behind a feature -flag. To use it, include `num-format = { version = "0.4", features = ["with-system-locale"] }` +flag. To use it, include `num-format = { version = "0.4.3", features = ["with-system-locale"] }` in your `Cargo.toml`. Additionally, on Windows (but **only** on Windows), using `SystemLocale` requires Clang 3.9 or higher. @@ -178,7 +177,8 @@ fn main() -> Result<(), Error> { # Requirements -* Rust 1.31 or greater +* Rust 1.56.0 or greater if compiled with `--no-default-features` +* Rust 1.58.0 or greater if compiled with default features * If you're using the `with-system-locale` feature **and** you're on Windows, Clang 3.9 or higher is also required. See [here](https://rust-lang.github.io/rust-bindgen/requirements.html) for installation instructions. @@ -187,10 +187,10 @@ fn main() -> Result<(), Error> { | Available features | What to put in your `Cargo.toml` | | :------------------- | :-------------------------------------------------------------------- | -| `no_std` | `num-format = { version = "0.4", default-features = false }` | -| `with-num-bigint` | `num-format = { version = "0.4", features = ["with-num-bigint"] }` | -| `with-serde` | `num-format = { version = "0.4", features = ["with-serde"] }` | -| `with-system-locale` | `num-format = { version = "0.4", features = ["with-system-locale"] }` | +| `no_std` | `num-format = { version = "0.4.3", default-features = false }` | +| `with-num-bigint` | `num-format = { version = "0.4.3", features = ["with-num-bigint"] }` | +| `with-serde` | `num-format = { version = "0.4.3", features = ["with-serde"] }` | +| `with-system-locale` | `num-format = { version = "0.4.3", features = ["with-system-locale"] }` | # License @@ -202,45 +202,42 @@ fn main() -> Result<(), Error> { at your option. [bindgen]: https://crates.io/crates/bindgen -[`Buffer`]: https://docs.rs/num-format/0.4.0/num_format/struct.Buffer.html +[`Buffer`]: https://docs.rs/num-format/0.4.3/num_format/struct.Buffer.html [Common Locale Data Repository]: https://en.wikipedia.org/wiki/Common_Locale_Data_Repository -[`CustomFormat`]: https://docs.rs/num-format/0.4.0/num_format/struct.CustomFormat.html +[`CustomFormat`]: https://docs.rs/num-format/0.4.3/num_format/struct.CustomFormat.html [`File`]: https://doc.rust-lang.org/std/fs/struct.File.html [`fmt::Write`]: https://doc.rust-lang.org/std/fmt/fn.write.html -[`Format`]: https://docs.rs/num-format/0.4.0/num_format/trait.Format.html +[`Format`]: https://docs.rs/num-format/0.4.3/num_format/trait.Format.html [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html -[`Locale`]: https://docs.rs/num-format/0.4.0/num_format/enum.Locale.html +[`Locale`]: https://docs.rs/num-format/0.4.3/num_format/enum.Locale.html [`num_bigint::BigInt`]: https://docs.rs/num-bigint/0.2.2/num_bigint/struct.BigInt.html [picking a format]: #picking-a-format [`String`]: https://doc.rust-lang.org/std/string/struct.String.html [The Apache License, Version 2.0]: http://www.apache.org/licenses/LICENSE-2.0 [The MIT license]: http://opensource.org/licenses/MIT -[`ToFormattedString`]: https://docs.rs/num-format/0.4.0/num_format/trait.ToFormattedString.html -[`to_formatted_string`]: https://docs.rs/num-format/0.4.0/num_format/trait.ToFormattedString.html#method.to_formatted_string +[`ToFormattedString`]: https://docs.rs/num-format/0.4.3/num_format/trait.ToFormattedString.html +[`to_formatted_string`]: https://docs.rs/num-format/0.4.3/num_format/trait.ToFormattedString.html#method.to_formatted_string [Unicode Consortium]: https://en.wikipedia.org/wiki/Unicode_Consortium [`Vec`]: https://doc.rust-lang.org/std/vec/struct.Vec.html -[`WriteFormatted`]: https://docs.rs/num-format/0.4.0/num_format/trait.WriteFormatted.html +[`WriteFormatted`]: https://docs.rs/num-format/0.4.3/num_format/trait.WriteFormatted.html */ #![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::needless_doctest_main)] #![deny( dead_code, deprecated, - // missing_copy_implementations, + future_incompatible, + missing_copy_implementations, missing_debug_implementations, missing_docs, + nonstandard_style, + rust_2018_idioms, trivial_casts, trivial_numeric_casts, - unused_extern_crates, - unused_imports, - unused_macros, - unused_mut, - unused_results, - unused_parens, - unused_unsafe, - unused_variables + unused )] -#![doc(html_root_url = "https://docs.rs/num-format/0.4.0")] +#![doc(html_root_url = "https://docs.rs/num-format/0.4.4")] #[cfg(all(feature = "with-system-locale", unix))] #[macro_use] @@ -264,6 +261,7 @@ mod format; mod grouping; mod impls; mod locale; +pub mod parsing; mod strings; #[cfg(all(feature = "with-system-locale", any(unix, windows)))] mod system_locale; diff --git a/num-format/src/locale.rs b/num-format/src/locale.rs index 6cff0fe..d7667c5 100644 --- a/num-format/src/locale.rs +++ b/num-format/src/locale.rs @@ -4,7 +4,7 @@ use crate::format::Format; use crate::grouping::Grouping; use crate::strings::{DecimalStr, InfinityStr, MinusSignStr, NanStr, PlusSignStr, SeparatorStr}; use core::str::FromStr; -const AVAILABLE_NAMES: [&'static str; 538usize] = [ +const AVAILABLE_NAMES: [&str; 542usize] = [ "af", "af-NA", "agq", @@ -67,6 +67,7 @@ const AVAILABLE_NAMES: [&'static str; 538usize] = [ "ccp", "ccp-IN", "ce", + "ceb", "cgg", "chr", "ckb", @@ -97,6 +98,7 @@ const AVAILABLE_NAMES: [&'static str; 538usize] = [ "en", "en-001", "en-150", + "en-AE", "en-AG", "en-AI", "en-AS", @@ -299,6 +301,7 @@ const AVAILABLE_NAMES: [&'static str; 538usize] = [ "fur", "fy", "ga", + "ga-GB", "gd", "gl", "gsw", @@ -420,6 +423,7 @@ const AVAILABLE_NAMES: [&'static str; 538usize] = [ "pl", "prg", "ps", + "ps-PK", "pt", "pt-AO", "pt-CH", @@ -632,6 +636,7 @@ pub enum Locale { ccp, ccp_IN, ce, + ceb, cgg, chr, ckb, @@ -662,6 +667,7 @@ pub enum Locale { en, en_001, en_150, + en_AE, en_AG, en_AI, en_AS, @@ -864,6 +870,7 @@ pub enum Locale { fur, fy, ga, + ga_GB, gd, gl, gsw, @@ -985,6 +992,7 @@ pub enum Locale { pl, prg, ps, + ps_PK, pt, pt_AO, pt_CH, @@ -1140,34 +1148,34 @@ impl Locale { agq => ",", ak => ".", am => ".", - ar => "\u{66b}", - ar_AE => "\u{66b}", - ar_BH => "\u{66b}", - ar_DJ => "\u{66b}", + ar => "٫", + ar_AE => "٫", + ar_BH => "٫", + ar_DJ => "٫", ar_DZ => ",", - ar_EG => "\u{66b}", + ar_EG => "٫", ar_EH => ".", - ar_ER => "\u{66b}", - ar_IL => "\u{66b}", - ar_IQ => "\u{66b}", - ar_JO => "\u{66b}", - ar_KM => "\u{66b}", - ar_KW => "\u{66b}", - ar_LB => "\u{66b}", + ar_ER => "٫", + ar_IL => "٫", + ar_IQ => "٫", + ar_JO => "٫", + ar_KM => "٫", + ar_KW => "٫", + ar_LB => "٫", ar_LY => ",", ar_MA => ",", - ar_MR => "\u{66b}", - ar_OM => "\u{66b}", - ar_PS => "\u{66b}", - ar_QA => "\u{66b}", - ar_SA => "\u{66b}", - ar_SD => "\u{66b}", - ar_SO => "\u{66b}", - ar_SS => "\u{66b}", - ar_SY => "\u{66b}", - ar_TD => "\u{66b}", + ar_MR => "٫", + ar_OM => "٫", + ar_PS => "٫", + ar_QA => "٫", + ar_SA => "٫", + ar_SD => "٫", + ar_SO => "٫", + ar_SS => "٫", + ar_SY => "٫", + ar_TD => "٫", ar_TN => ",", - ar_YE => "\u{66b}", + ar_YE => "٫", as_ => ".", asa => ".", ast => ",", @@ -1197,10 +1205,11 @@ impl Locale { ccp => ".", ccp_IN => ".", ce => ".", + ceb => ".", cgg => ".", chr => ".", - ckb => "\u{66b}", - ckb_IR => "\u{66b}", + ckb => "٫", + ckb_IR => "٫", cs => ",", cu => ".", cy => ".", @@ -1226,7 +1235,8 @@ impl Locale { el_CY => ",", en => ".", en_001 => ".", - en_150 => ",", + en_150 => ".", + en_AE => ".", en_AG => ".", en_AI => ".", en_AS => ".", @@ -1241,7 +1251,7 @@ impl Locale { en_BZ => ".", en_CA => ".", en_CC => ".", - en_CH => ",", + en_CH => ".", en_CK => ".", en_CM => ".", en_CX => ".", @@ -1361,8 +1371,8 @@ impl Locale { et => ",", eu => ",", ewo => ",", - fa => "\u{66b}", - fa_AF => "\u{66b}", + fa => "٫", + fa_AF => "٫", ff => ",", ff_Latn => ",", ff_Latn_BF => ",", @@ -1429,6 +1439,7 @@ impl Locale { fur => ",", fy => ",", ga => ".", + ga_GB => ".", gd => ".", gl => ",", gsw => ".", @@ -1477,7 +1488,7 @@ impl Locale { ko => ".", ko_KP => ".", kok => ".", - ks => "\u{66b}", + ks => "٫", ksb => ".", ksf => ",", ksh => ",", @@ -1493,8 +1504,8 @@ impl Locale { ln_CF => ",", ln_CG => ",", lo => ",", - lrc => "\u{66b}", - lrc_IQ => "\u{66b}", + lrc => "٫", + lrc_IQ => "٫", lt => ",", lu => ",", luo => ".", @@ -1518,7 +1529,7 @@ impl Locale { mt => ".", mua => ",", my => ".", - mzn => "\u{66b}", + mzn => "٫", naq => ".", nb => ",", nb_SJ => ",", @@ -1545,11 +1556,12 @@ impl Locale { os => ",", os_RU => ",", pa => ".", - pa_Arab => "\u{66b}", + pa_Arab => "٫", pa_Guru => ".", pl => ",", prg => ".", - ps => "\u{66b}", + ps => "٫", + ps_PK => "٫", pt => ",", pt_AO => ",", pt_CH => ",", @@ -1582,7 +1594,7 @@ impl Locale { sah => ",", saq => ".", sbp => ".", - sd => "\u{66b}", + sd => "٫", se => ",", se_FI => ",", se_SE => ",", @@ -1641,9 +1653,9 @@ impl Locale { ug => ".", uk => ",", ur => ".", - ur_IN => "\u{66b}", + ur_IN => "٫", uz => ",", - uz_Arab => "\u{66b}", + uz_Arab => "٫", uz_Cyrl => ",", uz_Latn => ",", vai => ".", @@ -1744,6 +1756,7 @@ impl Locale { ccp => Indian, ccp_IN => Indian, ce => Standard, + ceb => Standard, cgg => Standard, chr => Standard, ckb => Standard, @@ -1774,6 +1787,7 @@ impl Locale { en => Standard, en_001 => Standard, en_150 => Standard, + en_AE => Standard, en_AG => Standard, en_AI => Standard, en_AS => Standard, @@ -1976,6 +1990,7 @@ impl Locale { fur => Standard, fy => Standard, ga => Standard, + ga_GB => Standard, gd => Standard, gl => Standard, gsw => Standard, @@ -2023,7 +2038,7 @@ impl Locale { kn => Standard, ko => Standard, ko_KP => Standard, - kok => Indian, + kok => Standard, ks => Indian, ksb => Standard, ksf => Standard, @@ -2072,8 +2087,8 @@ impl Locale { nd => Standard, nds => Standard, nds_NL => Standard, - ne => Standard, - ne_IN => Standard, + ne => Indian, + ne_IN => Indian, nl => Standard, nl_AW => Standard, nl_BE => Standard, @@ -2097,6 +2112,7 @@ impl Locale { pl => Standard, prg => Standard, ps => Standard, + ps_PK => Standard, pt => Standard, pt_AO => Standard, pt_CH => Standard, @@ -2226,544 +2242,548 @@ impl Locale { pub fn infinity(&self) -> &'static str { use self::Locale::*; match self { - af => "\u{221e}", - af_NA => "\u{221e}", - agq => "\u{221e}", - ak => "\u{221e}", - am => "\u{221e}", - ar => "\u{221e}", - ar_AE => "\u{221e}", - ar_BH => "\u{221e}", - ar_DJ => "\u{221e}", - ar_DZ => "\u{221e}", - ar_EG => "\u{221e}", - ar_EH => "\u{221e}", - ar_ER => "\u{221e}", - ar_IL => "\u{221e}", - ar_IQ => "\u{221e}", - ar_JO => "\u{221e}", - ar_KM => "\u{221e}", - ar_KW => "\u{221e}", - ar_LB => "\u{221e}", - ar_LY => "\u{221e}", - ar_MA => "\u{221e}", - ar_MR => "\u{221e}", - ar_OM => "\u{221e}", - ar_PS => "\u{221e}", - ar_QA => "\u{221e}", - ar_SA => "\u{221e}", - ar_SD => "\u{221e}", - ar_SO => "\u{221e}", - ar_SS => "\u{221e}", - ar_SY => "\u{221e}", - ar_TD => "\u{221e}", - ar_TN => "\u{221e}", - ar_YE => "\u{221e}", - as_ => "\u{221e}", - asa => "\u{221e}", - ast => "\u{221e}", - az => "\u{221e}", - az_Cyrl => "\u{221e}", - az_Latn => "\u{221e}", - bas => "\u{221e}", - be => "\u{221e}", - bem => "\u{221e}", - bez => "\u{221e}", - bg => "\u{221e}", - bm => "\u{221e}", - bn => "\u{221e}", - bn_IN => "\u{221e}", - bo => "\u{221e}", - bo_IN => "\u{221e}", - br => "\u{221e}", - brx => "\u{221e}", - bs => "\u{221e}", - bs_Cyrl => "\u{221e}", - bs_Latn => "\u{221e}", - ca => "\u{221e}", - ca_AD => "\u{221e}", - ca_ES_VALENCIA => "\u{221e}", - ca_FR => "\u{221e}", - ca_IT => "\u{221e}", - ccp => "\u{221e}", - ccp_IN => "\u{221e}", - ce => "\u{221e}", - cgg => "\u{221e}", - chr => "\u{221e}", - ckb => "\u{221e}", - ckb_IR => "\u{221e}", - cs => "\u{221e}", - cu => "\u{221e}", - cy => "\u{221e}", - da => "\u{221e}", - da_GL => "\u{221e}", - dav => "\u{221e}", - de => "\u{221e}", - de_AT => "\u{221e}", - de_BE => "\u{221e}", - de_CH => "\u{221e}", - de_IT => "\u{221e}", - de_LI => "\u{221e}", - de_LU => "\u{221e}", - dje => "\u{221e}", - dsb => "\u{221e}", - dua => "\u{221e}", - dyo => "\u{221e}", - dz => "\u{f42}\u{fb2}\u{f44}\u{f66}\u{f0b}\u{f58}\u{f7a}\u{f51}", - ebu => "\u{221e}", - ee => "\u{221e}", - ee_TG => "\u{221e}", - el => "\u{221e}", - el_CY => "\u{221e}", - en => "\u{221e}", - en_001 => "\u{221e}", - en_150 => "\u{221e}", - en_AG => "\u{221e}", - en_AI => "\u{221e}", - en_AS => "\u{221e}", - en_AT => "\u{221e}", - en_AU => "\u{221e}", - en_BB => "\u{221e}", - en_BE => "\u{221e}", - en_BI => "\u{221e}", - en_BM => "\u{221e}", - en_BS => "\u{221e}", - en_BW => "\u{221e}", - en_BZ => "\u{221e}", - en_CA => "\u{221e}", - en_CC => "\u{221e}", - en_CH => "\u{221e}", - en_CK => "\u{221e}", - en_CM => "\u{221e}", - en_CX => "\u{221e}", - en_CY => "\u{221e}", - en_DE => "\u{221e}", - en_DG => "\u{221e}", - en_DK => "\u{221e}", - en_DM => "\u{221e}", - en_ER => "\u{221e}", - en_FI => "\u{221e}", - en_FJ => "\u{221e}", - en_FK => "\u{221e}", - en_FM => "\u{221e}", - en_GB => "\u{221e}", - en_GD => "\u{221e}", - en_GG => "\u{221e}", - en_GH => "\u{221e}", - en_GI => "\u{221e}", - en_GM => "\u{221e}", - en_GU => "\u{221e}", - en_GY => "\u{221e}", - en_HK => "\u{221e}", - en_IE => "\u{221e}", - en_IL => "\u{221e}", - en_IM => "\u{221e}", - en_IN => "\u{221e}", - en_IO => "\u{221e}", - en_JE => "\u{221e}", - en_JM => "\u{221e}", - en_KE => "\u{221e}", - en_KI => "\u{221e}", - en_KN => "\u{221e}", - en_KY => "\u{221e}", - en_LC => "\u{221e}", - en_LR => "\u{221e}", - en_LS => "\u{221e}", - en_MG => "\u{221e}", - en_MH => "\u{221e}", - en_MO => "\u{221e}", - en_MP => "\u{221e}", - en_MS => "\u{221e}", - en_MT => "\u{221e}", - en_MU => "\u{221e}", - en_MW => "\u{221e}", - en_MY => "\u{221e}", - en_NA => "\u{221e}", - en_NF => "\u{221e}", - en_NG => "\u{221e}", - en_NL => "\u{221e}", - en_NR => "\u{221e}", - en_NU => "\u{221e}", - en_NZ => "\u{221e}", - en_PG => "\u{221e}", - en_PH => "\u{221e}", - en_PK => "\u{221e}", - en_PN => "\u{221e}", - en_PR => "\u{221e}", - en_PW => "\u{221e}", - en_RW => "\u{221e}", - en_SB => "\u{221e}", - en_SC => "\u{221e}", - en_SD => "\u{221e}", - en_SE => "\u{221e}", - en_SG => "\u{221e}", - en_SH => "\u{221e}", - en_SI => "\u{221e}", - en_SL => "\u{221e}", - en_SS => "\u{221e}", - en_SX => "\u{221e}", - en_SZ => "\u{221e}", - en_TC => "\u{221e}", - en_TK => "\u{221e}", - en_TO => "\u{221e}", - en_TT => "\u{221e}", - en_TV => "\u{221e}", - en_TZ => "\u{221e}", - en_UG => "\u{221e}", - en_UM => "\u{221e}", + af => "∞", + af_NA => "∞", + agq => "∞", + ak => "∞", + am => "∞", + ar => "∞", + ar_AE => "∞", + ar_BH => "∞", + ar_DJ => "∞", + ar_DZ => "∞", + ar_EG => "∞", + ar_EH => "∞", + ar_ER => "∞", + ar_IL => "∞", + ar_IQ => "∞", + ar_JO => "∞", + ar_KM => "∞", + ar_KW => "∞", + ar_LB => "∞", + ar_LY => "∞", + ar_MA => "∞", + ar_MR => "∞", + ar_OM => "∞", + ar_PS => "∞", + ar_QA => "∞", + ar_SA => "∞", + ar_SD => "∞", + ar_SO => "∞", + ar_SS => "∞", + ar_SY => "∞", + ar_TD => "∞", + ar_TN => "∞", + ar_YE => "∞", + as_ => "∞", + asa => "∞", + ast => "∞", + az => "∞", + az_Cyrl => "∞", + az_Latn => "∞", + bas => "∞", + be => "∞", + bem => "∞", + bez => "∞", + bg => "∞", + bm => "∞", + bn => "∞", + bn_IN => "∞", + bo => "∞", + bo_IN => "∞", + br => "∞", + brx => "∞", + bs => "∞", + bs_Cyrl => "∞", + bs_Latn => "∞", + ca => "∞", + ca_AD => "∞", + ca_ES_VALENCIA => "∞", + ca_FR => "∞", + ca_IT => "∞", + ccp => "∞", + ccp_IN => "∞", + ce => "∞", + ceb => "∞", + cgg => "∞", + chr => "∞", + ckb => "∞", + ckb_IR => "∞", + cs => "∞", + cu => "∞", + cy => "∞", + da => "∞", + da_GL => "∞", + dav => "∞", + de => "∞", + de_AT => "∞", + de_BE => "∞", + de_CH => "∞", + de_IT => "∞", + de_LI => "∞", + de_LU => "∞", + dje => "∞", + dsb => "∞", + dua => "∞", + dyo => "∞", + dz => "ག\u{fb2}ངས་མ\u{f7a}ད", + ebu => "∞", + ee => "∞", + ee_TG => "∞", + el => "∞", + el_CY => "∞", + en => "∞", + en_001 => "∞", + en_150 => "∞", + en_AE => "∞", + en_AG => "∞", + en_AI => "∞", + en_AS => "∞", + en_AT => "∞", + en_AU => "∞", + en_BB => "∞", + en_BE => "∞", + en_BI => "∞", + en_BM => "∞", + en_BS => "∞", + en_BW => "∞", + en_BZ => "∞", + en_CA => "∞", + en_CC => "∞", + en_CH => "∞", + en_CK => "∞", + en_CM => "∞", + en_CX => "∞", + en_CY => "∞", + en_DE => "∞", + en_DG => "∞", + en_DK => "∞", + en_DM => "∞", + en_ER => "∞", + en_FI => "∞", + en_FJ => "∞", + en_FK => "∞", + en_FM => "∞", + en_GB => "∞", + en_GD => "∞", + en_GG => "∞", + en_GH => "∞", + en_GI => "∞", + en_GM => "∞", + en_GU => "∞", + en_GY => "∞", + en_HK => "∞", + en_IE => "∞", + en_IL => "∞", + en_IM => "∞", + en_IN => "∞", + en_IO => "∞", + en_JE => "∞", + en_JM => "∞", + en_KE => "∞", + en_KI => "∞", + en_KN => "∞", + en_KY => "∞", + en_LC => "∞", + en_LR => "∞", + en_LS => "∞", + en_MG => "∞", + en_MH => "∞", + en_MO => "∞", + en_MP => "∞", + en_MS => "∞", + en_MT => "∞", + en_MU => "∞", + en_MW => "∞", + en_MY => "∞", + en_NA => "∞", + en_NF => "∞", + en_NG => "∞", + en_NL => "∞", + en_NR => "∞", + en_NU => "∞", + en_NZ => "∞", + en_PG => "∞", + en_PH => "∞", + en_PK => "∞", + en_PN => "∞", + en_PR => "∞", + en_PW => "∞", + en_RW => "∞", + en_SB => "∞", + en_SC => "∞", + en_SD => "∞", + en_SE => "∞", + en_SG => "∞", + en_SH => "∞", + en_SI => "∞", + en_SL => "∞", + en_SS => "∞", + en_SX => "∞", + en_SZ => "∞", + en_TC => "∞", + en_TK => "∞", + en_TO => "∞", + en_TT => "∞", + en_TV => "∞", + en_TZ => "∞", + en_UG => "∞", + en_UM => "∞", en_US_POSIX => "INF", - en_VC => "\u{221e}", - en_VG => "\u{221e}", - en_VI => "\u{221e}", - en_VU => "\u{221e}", - en_WS => "\u{221e}", - en_ZA => "\u{221e}", - en_ZM => "\u{221e}", - en_ZW => "\u{221e}", - eo => "\u{221e}", - es => "\u{221e}", - es_419 => "\u{221e}", - es_AR => "\u{221e}", - es_BO => "\u{221e}", - es_BR => "\u{221e}", - es_BZ => "\u{221e}", - es_CL => "\u{221e}", - es_CO => "\u{221e}", - es_CR => "\u{221e}", - es_CU => "\u{221e}", - es_DO => "\u{221e}", - es_EA => "\u{221e}", - es_EC => "\u{221e}", - es_GQ => "\u{221e}", - es_GT => "\u{221e}", - es_HN => "\u{221e}", - es_IC => "\u{221e}", - es_MX => "\u{221e}", - es_NI => "\u{221e}", - es_PA => "\u{221e}", - es_PE => "\u{221e}", - es_PH => "\u{221e}", - es_PR => "\u{221e}", - es_PY => "\u{221e}", - es_SV => "\u{221e}", - es_US => "\u{221e}", - es_UY => "\u{221e}", - es_VE => "\u{221e}", - et => "\u{221e}", - eu => "\u{221e}", - ewo => "\u{221e}", - fa => "\u{221e}", - fa_AF => "\u{221e}", - ff => "\u{221e}", - ff_Latn => "\u{221e}", - ff_Latn_BF => "\u{221e}", - ff_Latn_CM => "\u{221e}", - ff_Latn_GH => "\u{221e}", - ff_Latn_GM => "\u{221e}", - ff_Latn_GN => "\u{221e}", - ff_Latn_GW => "\u{221e}", - ff_Latn_LR => "\u{221e}", - ff_Latn_MR => "\u{221e}", - ff_Latn_NE => "\u{221e}", - ff_Latn_NG => "\u{221e}", - ff_Latn_SL => "\u{221e}", - fi => "\u{221e}", - fil => "\u{221e}", - fo => "\u{221e}", - fo_DK => "\u{221e}", - fr => "\u{221e}", - fr_BE => "\u{221e}", - fr_BF => "\u{221e}", - fr_BI => "\u{221e}", - fr_BJ => "\u{221e}", - fr_BL => "\u{221e}", - fr_CA => "\u{221e}", - fr_CD => "\u{221e}", - fr_CF => "\u{221e}", - fr_CG => "\u{221e}", - fr_CH => "\u{221e}", - fr_CI => "\u{221e}", - fr_CM => "\u{221e}", - fr_DJ => "\u{221e}", - fr_DZ => "\u{221e}", - fr_GA => "\u{221e}", - fr_GF => "\u{221e}", - fr_GN => "\u{221e}", - fr_GP => "\u{221e}", - fr_GQ => "\u{221e}", - fr_HT => "\u{221e}", - fr_KM => "\u{221e}", - fr_LU => "\u{221e}", - fr_MA => "\u{221e}", - fr_MC => "\u{221e}", - fr_MF => "\u{221e}", - fr_MG => "\u{221e}", - fr_ML => "\u{221e}", - fr_MQ => "\u{221e}", - fr_MR => "\u{221e}", - fr_MU => "\u{221e}", - fr_NC => "\u{221e}", - fr_NE => "\u{221e}", - fr_PF => "\u{221e}", - fr_PM => "\u{221e}", - fr_RE => "\u{221e}", - fr_RW => "\u{221e}", - fr_SC => "\u{221e}", - fr_SN => "\u{221e}", - fr_SY => "\u{221e}", - fr_TD => "\u{221e}", - fr_TG => "\u{221e}", - fr_TN => "\u{221e}", - fr_VU => "\u{221e}", - fr_WF => "\u{221e}", - fr_YT => "\u{221e}", - fur => "\u{221e}", - fy => "\u{221e}", - ga => "\u{221e}", - gd => "\u{221e}", - gl => "\u{221e}", - gsw => "\u{221e}", - gsw_FR => "\u{221e}", - gsw_LI => "\u{221e}", - gu => "\u{221e}", - guz => "\u{221e}", - gv => "\u{221e}", - ha => "\u{221e}", - ha_GH => "\u{221e}", - ha_NE => "\u{221e}", - haw => "\u{221e}", - he => "\u{221e}", - hi => "\u{221e}", - hr => "\u{221e}", - hr_BA => "\u{221e}", - hsb => "\u{221e}", - hu => "\u{221e}", - hy => "\u{221e}", - ia => "\u{221e}", - id => "\u{221e}", - ig => "\u{221e}", - ii => "\u{221e}", - is => "\u{221e}", - it => "\u{221e}", - it_CH => "\u{221e}", - it_SM => "\u{221e}", - it_VA => "\u{221e}", - ja => "\u{221e}", - jgo => "\u{221e}", - jmc => "\u{221e}", - jv => "\u{221e}", - ka => "\u{221e}", - kab => "\u{221e}", - kam => "\u{221e}", - kde => "\u{221e}", - kea => "\u{221e}", - khq => "\u{221e}", - ki => "\u{221e}", - kk => "\u{221e}", - kkj => "\u{221e}", - kl => "\u{221e}", - kln => "\u{221e}", - km => "\u{221e}", - kn => "\u{221e}", - ko => "\u{221e}", - ko_KP => "\u{221e}", - kok => "\u{221e}", - ks => "\u{221e}", - ksb => "\u{221e}", - ksf => "\u{221e}", - ksh => "\u{221e}", - ku => "\u{221e}", - kw => "\u{221e}", - ky => "\u{221e}", - lag => "\u{221e}", - lb => "\u{221e}", - lg => "\u{221e}", - lkt => "\u{221e}", - ln => "\u{221e}", - ln_AO => "\u{221e}", - ln_CF => "\u{221e}", - ln_CG => "\u{221e}", - lo => "\u{221e}", - lrc => "\u{221e}", - lrc_IQ => "\u{221e}", - lt => "\u{221e}", - lu => "\u{221e}", - luo => "\u{221e}", - luy => "\u{221e}", - lv => "\u{221e}", - mas => "\u{221e}", - mas_TZ => "\u{221e}", - mer => "\u{221e}", - mfe => "\u{221e}", - mg => "\u{221e}", - mgh => "\u{221e}", - mgo => "\u{221e}", - mi => "\u{221e}", - mk => "\u{221e}", - ml => "\u{221e}", - mn => "\u{221e}", - mr => "\u{221e}", - ms => "\u{221e}", - ms_BN => "\u{221e}", - ms_SG => "\u{221e}", - mt => "\u{221e}", - mua => "\u{221e}", - my => "\u{221e}", - mzn => "\u{221e}", - naq => "\u{221e}", - nb => "\u{221e}", - nb_SJ => "\u{221e}", - nd => "\u{221e}", - nds => "\u{221e}", - nds_NL => "\u{221e}", - ne => "\u{221e}", - ne_IN => "\u{221e}", - nl => "\u{221e}", - nl_AW => "\u{221e}", - nl_BE => "\u{221e}", - nl_BQ => "\u{221e}", - nl_CW => "\u{221e}", - nl_SR => "\u{221e}", - nl_SX => "\u{221e}", - nmg => "\u{221e}", - nn => "\u{221e}", - nnh => "\u{221e}", - nus => "\u{221e}", - nyn => "\u{221e}", - om => "\u{221e}", - om_KE => "\u{221e}", - or => "\u{221e}", - os => "\u{221e}", - os_RU => "\u{221e}", - pa => "\u{221e}", - pa_Arab => "\u{221e}", - pa_Guru => "\u{221e}", - pl => "\u{221e}", - prg => "\u{221e}", - ps => "\u{221e}", - pt => "\u{221e}", - pt_AO => "\u{221e}", - pt_CH => "\u{221e}", - pt_CV => "\u{221e}", - pt_GQ => "\u{221e}", - pt_GW => "\u{221e}", - pt_LU => "\u{221e}", - pt_MO => "\u{221e}", - pt_MZ => "\u{221e}", - pt_PT => "\u{221e}", - pt_ST => "\u{221e}", - pt_TL => "\u{221e}", - qu => "\u{221e}", - qu_BO => "\u{221e}", - qu_EC => "\u{221e}", - rm => "\u{221e}", - rn => "\u{221e}", - ro => "\u{221e}", - ro_MD => "\u{221e}", - rof => "\u{221e}", - root => "\u{221e}", - ru => "\u{221e}", - ru_BY => "\u{221e}", - ru_KG => "\u{221e}", - ru_KZ => "\u{221e}", - ru_MD => "\u{221e}", - ru_UA => "\u{221e}", - rw => "\u{221e}", - rwk => "\u{221e}", - sah => "\u{221e}", - saq => "\u{221e}", - sbp => "\u{221e}", - sd => "\u{221e}", - se => "\u{221e}", - se_FI => "\u{221e}", - se_SE => "\u{221e}", - seh => "\u{221e}", - ses => "\u{221e}", - sg => "\u{221e}", - shi => "\u{221e}", - shi_Latn => "\u{221e}", - shi_Tfng => "\u{221e}", - si => "\u{221e}", - sk => "\u{221e}", - sl => "\u{221e}", - smn => "\u{221e}", - sn => "\u{221e}", - so => "\u{221e}", - so_DJ => "\u{221e}", - so_ET => "\u{221e}", - so_KE => "\u{221e}", - sq => "\u{221e}", - sq_MK => "\u{221e}", - sq_XK => "\u{221e}", - sr => "\u{221e}", - sr_Cyrl => "\u{221e}", - sr_Cyrl_BA => "\u{221e}", - sr_Cyrl_ME => "\u{221e}", - sr_Cyrl_XK => "\u{221e}", - sr_Latn => "\u{221e}", - sr_Latn_BA => "\u{221e}", - sr_Latn_ME => "\u{221e}", - sr_Latn_XK => "\u{221e}", - sv => "\u{221e}", - sv_AX => "\u{221e}", - sv_FI => "\u{221e}", - sw => "\u{221e}", - sw_CD => "\u{221e}", - sw_KE => "\u{221e}", - sw_UG => "\u{221e}", - ta => "\u{221e}", - ta_LK => "\u{221e}", - ta_MY => "\u{221e}", - ta_SG => "\u{221e}", - te => "\u{221e}", - teo => "\u{221e}", - teo_KE => "\u{221e}", - tg => "\u{221e}", - th => "\u{221e}", - ti => "\u{221e}", - ti_ER => "\u{221e}", - tk => "\u{221e}", - to => "\u{221e}", - tr => "\u{221e}", - tr_CY => "\u{221e}", - tt => "\u{221e}", - twq => "\u{221e}", - tzm => "\u{221e}", - ug => "\u{221e}", - uk => "\u{221e}", - ur => "\u{221e}", - ur_IN => "\u{221e}", - uz => "\u{221e}", - uz_Arab => "\u{221e}", - uz_Cyrl => "\u{221e}", - uz_Latn => "\u{221e}", - vai => "\u{221e}", - vai_Latn => "\u{221e}", - vai_Vaii => "\u{221e}", - vi => "\u{221e}", - vo => "\u{221e}", - vun => "\u{221e}", - wae => "\u{221e}", - wo => "\u{221e}", - xh => "\u{221e}", - xog => "\u{221e}", - yav => "\u{221e}", - yi => "\u{221e}", - yo => "\u{221e}", - yo_BJ => "\u{221e}", - yue => "\u{221e}", - yue_Hans => "\u{221e}", - yue_Hant => "\u{221e}", - zgh => "\u{221e}", - zh => "\u{221e}", - zh_Hans => "\u{221e}", - zh_Hans_HK => "\u{221e}", - zh_Hans_MO => "\u{221e}", - zh_Hans_SG => "\u{221e}", - zh_Hant => "\u{221e}", - zh_Hant_HK => "\u{221e}", - zh_Hant_MO => "\u{221e}", - zu => "\u{221e}", + en_VC => "∞", + en_VG => "∞", + en_VI => "∞", + en_VU => "∞", + en_WS => "∞", + en_ZA => "∞", + en_ZM => "∞", + en_ZW => "∞", + eo => "∞", + es => "∞", + es_419 => "∞", + es_AR => "∞", + es_BO => "∞", + es_BR => "∞", + es_BZ => "∞", + es_CL => "∞", + es_CO => "∞", + es_CR => "∞", + es_CU => "∞", + es_DO => "∞", + es_EA => "∞", + es_EC => "∞", + es_GQ => "∞", + es_GT => "∞", + es_HN => "∞", + es_IC => "∞", + es_MX => "∞", + es_NI => "∞", + es_PA => "∞", + es_PE => "∞", + es_PH => "∞", + es_PR => "∞", + es_PY => "∞", + es_SV => "∞", + es_US => "∞", + es_UY => "∞", + es_VE => "∞", + et => "∞", + eu => "∞", + ewo => "∞", + fa => "∞", + fa_AF => "∞", + ff => "∞", + ff_Latn => "∞", + ff_Latn_BF => "∞", + ff_Latn_CM => "∞", + ff_Latn_GH => "∞", + ff_Latn_GM => "∞", + ff_Latn_GN => "∞", + ff_Latn_GW => "∞", + ff_Latn_LR => "∞", + ff_Latn_MR => "∞", + ff_Latn_NE => "∞", + ff_Latn_NG => "∞", + ff_Latn_SL => "∞", + fi => "∞", + fil => "∞", + fo => "∞", + fo_DK => "∞", + fr => "∞", + fr_BE => "∞", + fr_BF => "∞", + fr_BI => "∞", + fr_BJ => "∞", + fr_BL => "∞", + fr_CA => "∞", + fr_CD => "∞", + fr_CF => "∞", + fr_CG => "∞", + fr_CH => "∞", + fr_CI => "∞", + fr_CM => "∞", + fr_DJ => "∞", + fr_DZ => "∞", + fr_GA => "∞", + fr_GF => "∞", + fr_GN => "∞", + fr_GP => "∞", + fr_GQ => "∞", + fr_HT => "∞", + fr_KM => "∞", + fr_LU => "∞", + fr_MA => "∞", + fr_MC => "∞", + fr_MF => "∞", + fr_MG => "∞", + fr_ML => "∞", + fr_MQ => "∞", + fr_MR => "∞", + fr_MU => "∞", + fr_NC => "∞", + fr_NE => "∞", + fr_PF => "∞", + fr_PM => "∞", + fr_RE => "∞", + fr_RW => "∞", + fr_SC => "∞", + fr_SN => "∞", + fr_SY => "∞", + fr_TD => "∞", + fr_TG => "∞", + fr_TN => "∞", + fr_VU => "∞", + fr_WF => "∞", + fr_YT => "∞", + fur => "∞", + fy => "∞", + ga => "∞", + ga_GB => "∞", + gd => "∞", + gl => "∞", + gsw => "∞", + gsw_FR => "∞", + gsw_LI => "∞", + gu => "∞", + guz => "∞", + gv => "∞", + ha => "∞", + ha_GH => "∞", + ha_NE => "∞", + haw => "∞", + he => "∞", + hi => "∞", + hr => "∞", + hr_BA => "∞", + hsb => "∞", + hu => "∞", + hy => "∞", + ia => "∞", + id => "∞", + ig => "∞", + ii => "∞", + is => "∞", + it => "∞", + it_CH => "∞", + it_SM => "∞", + it_VA => "∞", + ja => "∞", + jgo => "∞", + jmc => "∞", + jv => "∞", + ka => "∞", + kab => "∞", + kam => "∞", + kde => "∞", + kea => "∞", + khq => "∞", + ki => "∞", + kk => "∞", + kkj => "∞", + kl => "∞", + kln => "∞", + km => "∞", + kn => "∞", + ko => "∞", + ko_KP => "∞", + kok => "∞", + ks => "∞", + ksb => "∞", + ksf => "∞", + ksh => "∞", + ku => "∞", + kw => "∞", + ky => "∞", + lag => "∞", + lb => "∞", + lg => "∞", + lkt => "∞", + ln => "∞", + ln_AO => "∞", + ln_CF => "∞", + ln_CG => "∞", + lo => "∞", + lrc => "∞", + lrc_IQ => "∞", + lt => "∞", + lu => "∞", + luo => "∞", + luy => "∞", + lv => "∞", + mas => "∞", + mas_TZ => "∞", + mer => "∞", + mfe => "∞", + mg => "∞", + mgh => "∞", + mgo => "∞", + mi => "∞", + mk => "∞", + ml => "∞", + mn => "∞", + mr => "∞", + ms => "∞", + ms_BN => "∞", + ms_SG => "∞", + mt => "∞", + mua => "∞", + my => "∞", + mzn => "∞", + naq => "∞", + nb => "∞", + nb_SJ => "∞", + nd => "∞", + nds => "∞", + nds_NL => "∞", + ne => "∞", + ne_IN => "∞", + nl => "∞", + nl_AW => "∞", + nl_BE => "∞", + nl_BQ => "∞", + nl_CW => "∞", + nl_SR => "∞", + nl_SX => "∞", + nmg => "∞", + nn => "∞", + nnh => "∞", + nus => "∞", + nyn => "∞", + om => "∞", + om_KE => "∞", + or => "∞", + os => "∞", + os_RU => "∞", + pa => "∞", + pa_Arab => "∞", + pa_Guru => "∞", + pl => "∞", + prg => "∞", + ps => "∞", + ps_PK => "∞", + pt => "∞", + pt_AO => "∞", + pt_CH => "∞", + pt_CV => "∞", + pt_GQ => "∞", + pt_GW => "∞", + pt_LU => "∞", + pt_MO => "∞", + pt_MZ => "∞", + pt_PT => "∞", + pt_ST => "∞", + pt_TL => "∞", + qu => "∞", + qu_BO => "∞", + qu_EC => "∞", + rm => "∞", + rn => "∞", + ro => "∞", + ro_MD => "∞", + rof => "∞", + root => "∞", + ru => "∞", + ru_BY => "∞", + ru_KG => "∞", + ru_KZ => "∞", + ru_MD => "∞", + ru_UA => "∞", + rw => "∞", + rwk => "∞", + sah => "∞", + saq => "∞", + sbp => "∞", + sd => "∞", + se => "∞", + se_FI => "∞", + se_SE => "∞", + seh => "∞", + ses => "∞", + sg => "∞", + shi => "∞", + shi_Latn => "∞", + shi_Tfng => "∞", + si => "∞", + sk => "∞", + sl => "∞", + smn => "∞", + sn => "∞", + so => "∞", + so_DJ => "∞", + so_ET => "∞", + so_KE => "∞", + sq => "∞", + sq_MK => "∞", + sq_XK => "∞", + sr => "∞", + sr_Cyrl => "∞", + sr_Cyrl_BA => "∞", + sr_Cyrl_ME => "∞", + sr_Cyrl_XK => "∞", + sr_Latn => "∞", + sr_Latn_BA => "∞", + sr_Latn_ME => "∞", + sr_Latn_XK => "∞", + sv => "∞", + sv_AX => "∞", + sv_FI => "∞", + sw => "∞", + sw_CD => "∞", + sw_KE => "∞", + sw_UG => "∞", + ta => "∞", + ta_LK => "∞", + ta_MY => "∞", + ta_SG => "∞", + te => "∞", + teo => "∞", + teo_KE => "∞", + tg => "∞", + th => "∞", + ti => "∞", + ti_ER => "∞", + tk => "∞", + to => "∞", + tr => "∞", + tr_CY => "∞", + tt => "∞", + twq => "∞", + tzm => "∞", + ug => "∞", + uk => "∞", + ur => "∞", + ur_IN => "∞", + uz => "∞", + uz_Arab => "∞", + uz_Cyrl => "∞", + uz_Latn => "∞", + vai => "∞", + vai_Latn => "∞", + vai_Vaii => "∞", + vi => "∞", + vo => "∞", + vun => "∞", + wae => "∞", + wo => "∞", + xh => "∞", + xog => "∞", + yav => "∞", + yi => "∞", + yo => "∞", + yo_BJ => "∞", + yue => "∞", + yue_Hans => "∞", + yue_Hant => "∞", + zgh => "∞", + zh => "∞", + zh_Hans => "∞", + zh_Hans_HK => "∞", + zh_Hans_MO => "∞", + zh_Hans_SG => "∞", + zh_Hant => "∞", + zh_Hant_HK => "∞", + zh_Hant_MO => "∞", + zu => "∞", } } #[doc = r" Returns the locale's minus sign representation."] @@ -2832,6 +2852,7 @@ impl Locale { ccp => "-", ccp_IN => "-", ce => "-", + ceb => "-", cgg => "-", chr => "-", ckb => "\u{200f}-", @@ -2862,6 +2883,7 @@ impl Locale { en => "-", en_001 => "-", en_150 => "-", + en_AE => "-", en_AG => "-", en_AI => "-", en_AS => "-", @@ -2993,11 +3015,11 @@ impl Locale { es_US => "-", es_UY => "-", es_VE => "-", - et => "\u{2212}", - eu => "\u{2212}", + et => "−", + eu => "−", ewo => "-", - fa => "\u{200e}\u{2212}", - fa_AF => "\u{200e}\u{2212}", + fa => "\u{200e}−", + fa_AF => "\u{200e}−", ff => "-", ff_Latn => "-", ff_Latn_BF => "-", @@ -3011,10 +3033,10 @@ impl Locale { ff_Latn_NE => "-", ff_Latn_NG => "-", ff_Latn_SL => "-", - fi => "\u{2212}", + fi => "−", fil => "-", - fo => "\u{2212}", - fo_DK => "\u{2212}", + fo => "−", + fo_DK => "−", fr => "-", fr_BE => "-", fr_BF => "-", @@ -3064,11 +3086,12 @@ impl Locale { fur => "-", fy => "-", ga => "-", + ga_GB => "-", gd => "-", gl => "-", - gsw => "\u{2212}", - gsw_FR => "\u{2212}", - gsw_LI => "\u{2212}", + gsw => "−", + gsw_FR => "−", + gsw_LI => "−", gu => "-", guz => "-", gv => "-", @@ -3115,7 +3138,7 @@ impl Locale { ks => "\u{200e}-\u{200e}", ksb => "-", ksf => "-", - ksh => "\u{2212}", + ksh => "−", ku => "-", kw => "-", ky => "-", @@ -3130,7 +3153,7 @@ impl Locale { lo => "-", lrc => "\u{200e}-\u{200e}", lrc_IQ => "\u{200e}-\u{200e}", - lt => "\u{2212}", + lt => "−", lu => "-", luo => "-", luy => "-", @@ -3155,8 +3178,8 @@ impl Locale { my => "-", mzn => "\u{200e}-\u{200e}", naq => "-", - nb => "\u{2212}", - nb_SJ => "\u{2212}", + nb => "−", + nb_SJ => "−", nd => "-", nds => "-", nds_NL => "-", @@ -3170,7 +3193,7 @@ impl Locale { nl_SR => "-", nl_SX => "-", nmg => "-", - nn => "\u{2212}", + nn => "−", nnh => "-", nus => "-", nyn => "-", @@ -3185,6 +3208,7 @@ impl Locale { pl => "-", prg => "-", ps => "\u{200e}-\u{200e}", + ps_PK => "\u{200e}-\u{200e}", pt => "-", pt_AO => "-", pt_CH => "-", @@ -3200,7 +3224,7 @@ impl Locale { qu => "-", qu_BO => "-", qu_EC => "-", - rm => "\u{2212}", + rm => "−", rn => "-", ro => "-", ro_MD => "-", @@ -3218,9 +3242,9 @@ impl Locale { saq => "-", sbp => "-", sd => "\u{61c}-", - se => "\u{2212}", - se_FI => "\u{2212}", - se_SE => "\u{2212}", + se => "−", + se_FI => "−", + se_SE => "−", seh => "-", ses => "-", sg => "-", @@ -3229,7 +3253,7 @@ impl Locale { shi_Tfng => "-", si => "-", sk => "-", - sl => "\u{2212}", + sl => "−", smn => "-", sn => "-", so => "-", @@ -3248,9 +3272,9 @@ impl Locale { sr_Latn_BA => "-", sr_Latn_ME => "-", sr_Latn_XK => "-", - sv => "\u{2212}", - sv_AX => "\u{2212}", - sv_FI => "\u{2212}", + sv => "−", + sv_AX => "−", + sv_FI => "−", sw => "-", sw_CD => "-", sw_KE => "-", @@ -3376,6 +3400,7 @@ impl Locale { ccp => "ccp", ccp_IN => "ccp-IN", ce => "ce", + ceb => "ceb", cgg => "cgg", chr => "chr", ckb => "ckb", @@ -3406,6 +3431,7 @@ impl Locale { en => "en", en_001 => "en-001", en_150 => "en-150", + en_AE => "en-AE", en_AG => "en-AG", en_AI => "en-AI", en_AS => "en-AS", @@ -3608,6 +3634,7 @@ impl Locale { fur => "fur", fy => "fy", ga => "ga", + ga_GB => "ga-GB", gd => "gd", gl => "gl", gsw => "gsw", @@ -3729,6 +3756,7 @@ impl Locale { pl => "pl", prg => "prg", ps => "ps", + ps_PK => "ps-PK", pt => "pt", pt_AO => "pt-AO", pt_CH => "pt-CH", @@ -3857,7 +3885,550 @@ impl Locale { #[doc = r" Returns the locale's NaN representation."] pub fn nan(&self) -> &'static str { use self::Locale::*; - match self { af => "NaN" , af_NA => "NaN" , agq => "NaN" , ak => "NaN" , am => "NaN" , ar => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_AE => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_BH => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_DJ => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_DZ => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}\u{64b}\u{627}" , ar_EG => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_EH => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}\u{64b}\u{627}" , ar_ER => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_IL => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_IQ => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_JO => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_KM => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_KW => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_LB => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_LY => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}\u{64b}\u{627}" , ar_MA => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}\u{64b}\u{627}" , ar_MR => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_OM => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_PS => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_QA => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_SA => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_SD => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_SO => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_SS => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_SY => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_TD => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , ar_TN => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}\u{64b}\u{627}" , ar_YE => "\u{644}\u{64a}\u{633}\u{a0}\u{631}\u{642}\u{645}" , as_ => "NaN" , asa => "NaN" , ast => "ND" , az => "NaN" , az_Cyrl => "NaN" , az_Latn => "NaN" , bas => "NaN" , be => "NaN" , bem => "NaN" , bez => "NaN" , bg => "NaN" , bm => "NaN" , bn => "NaN" , bn_IN => "NaN" , bo => "NaN" , bo_IN => "NaN" , br => "NaN" , brx => "NaN" , bs => "NaN" , bs_Cyrl => "NaN" , bs_Latn => "NaN" , ca => "NaN" , ca_AD => "NaN" , ca_ES_VALENCIA => "NaN" , ca_FR => "NaN" , ca_IT => "NaN" , ccp => "NaN" , ccp_IN => "NaN" , ce => "\u{422}\u{435}\u{440}\u{445}\u{44c}\u{430}\u{448}\u{a0}\u{434}\u{430}\u{446}" , cgg => "NaN" , chr => "NaN" , ckb => "NaN" , ckb_IR => "NaN" , cs => "NaN" , cu => "NaN" , cy => "NaN" , da => "NaN" , da_GL => "NaN" , dav => "NaN" , de => "NaN" , de_AT => "NaN" , de_BE => "NaN" , de_CH => "NaN" , de_IT => "NaN" , de_LI => "NaN" , de_LU => "NaN" , dje => "NaN" , dsb => "NaN" , dua => "NaN" , dyo => "NaN" , dz => "\u{f68}\u{f44}\u{f0b}\u{f58}\u{f51}" , ebu => "NaN" , ee => "mnn" , ee_TG => "mnn" , el => "NaN" , el_CY => "NaN" , en => "NaN" , en_001 => "NaN" , en_150 => "NaN" , en_AG => "NaN" , en_AI => "NaN" , en_AS => "NaN" , en_AT => "NaN" , en_AU => "NaN" , en_BB => "NaN" , en_BE => "NaN" , en_BI => "NaN" , en_BM => "NaN" , en_BS => "NaN" , en_BW => "NaN" , en_BZ => "NaN" , en_CA => "NaN" , en_CC => "NaN" , en_CH => "NaN" , en_CK => "NaN" , en_CM => "NaN" , en_CX => "NaN" , en_CY => "NaN" , en_DE => "NaN" , en_DG => "NaN" , en_DK => "NaN" , en_DM => "NaN" , en_ER => "NaN" , en_FI => "NaN" , en_FJ => "NaN" , en_FK => "NaN" , en_FM => "NaN" , en_GB => "NaN" , en_GD => "NaN" , en_GG => "NaN" , en_GH => "NaN" , en_GI => "NaN" , en_GM => "NaN" , en_GU => "NaN" , en_GY => "NaN" , en_HK => "NaN" , en_IE => "NaN" , en_IL => "NaN" , en_IM => "NaN" , en_IN => "NaN" , en_IO => "NaN" , en_JE => "NaN" , en_JM => "NaN" , en_KE => "NaN" , en_KI => "NaN" , en_KN => "NaN" , en_KY => "NaN" , en_LC => "NaN" , en_LR => "NaN" , en_LS => "NaN" , en_MG => "NaN" , en_MH => "NaN" , en_MO => "NaN" , en_MP => "NaN" , en_MS => "NaN" , en_MT => "NaN" , en_MU => "NaN" , en_MW => "NaN" , en_MY => "NaN" , en_NA => "NaN" , en_NF => "NaN" , en_NG => "NaN" , en_NL => "NaN" , en_NR => "NaN" , en_NU => "NaN" , en_NZ => "NaN" , en_PG => "NaN" , en_PH => "NaN" , en_PK => "NaN" , en_PN => "NaN" , en_PR => "NaN" , en_PW => "NaN" , en_RW => "NaN" , en_SB => "NaN" , en_SC => "NaN" , en_SD => "NaN" , en_SE => "NaN" , en_SG => "NaN" , en_SH => "NaN" , en_SI => "NaN" , en_SL => "NaN" , en_SS => "NaN" , en_SX => "NaN" , en_SZ => "NaN" , en_TC => "NaN" , en_TK => "NaN" , en_TO => "NaN" , en_TT => "NaN" , en_TV => "NaN" , en_TZ => "NaN" , en_UG => "NaN" , en_UM => "NaN" , en_US_POSIX => "NaN" , en_VC => "NaN" , en_VG => "NaN" , en_VI => "NaN" , en_VU => "NaN" , en_WS => "NaN" , en_ZA => "NaN" , en_ZM => "NaN" , en_ZW => "NaN" , eo => "NaN" , es => "NaN" , es_419 => "NaN" , es_AR => "NaN" , es_BO => "NaN" , es_BR => "NaN" , es_BZ => "NaN" , es_CL => "NaN" , es_CO => "NaN" , es_CR => "NaN" , es_CU => "NaN" , es_DO => "NaN" , es_EA => "NaN" , es_EC => "NaN" , es_GQ => "NaN" , es_GT => "NaN" , es_HN => "NaN" , es_IC => "NaN" , es_MX => "NaN" , es_NI => "NaN" , es_PA => "NaN" , es_PE => "NaN" , es_PH => "NaN" , es_PR => "NaN" , es_PY => "NaN" , es_SV => "NaN" , es_US => "NaN" , es_UY => "NaN" , es_VE => "NaN" , et => "NaN" , eu => "NaN" , ewo => "NaN" , fa => "\u{646}\u{627}\u{639}\u{62f}\u{62f}" , fa_AF => "\u{646}\u{627}\u{639}\u{62f}\u{62f}" , ff => "NaN" , ff_Latn => "NaN" , ff_Latn_BF => "NaN" , ff_Latn_CM => "NaN" , ff_Latn_GH => "NaN" , ff_Latn_GM => "NaN" , ff_Latn_GN => "NaN" , ff_Latn_GW => "NaN" , ff_Latn_LR => "NaN" , ff_Latn_MR => "NaN" , ff_Latn_NE => "NaN" , ff_Latn_NG => "NaN" , ff_Latn_SL => "NaN" , fi => "ep\u{e4}luku" , fil => "NaN" , fo => "NaN" , fo_DK => "NaN" , fr => "NaN" , fr_BE => "NaN" , fr_BF => "NaN" , fr_BI => "NaN" , fr_BJ => "NaN" , fr_BL => "NaN" , fr_CA => "NaN" , fr_CD => "NaN" , fr_CF => "NaN" , fr_CG => "NaN" , fr_CH => "NaN" , fr_CI => "NaN" , fr_CM => "NaN" , fr_DJ => "NaN" , fr_DZ => "NaN" , fr_GA => "NaN" , fr_GF => "NaN" , fr_GN => "NaN" , fr_GP => "NaN" , fr_GQ => "NaN" , fr_HT => "NaN" , fr_KM => "NaN" , fr_LU => "NaN" , fr_MA => "NaN" , fr_MC => "NaN" , fr_MF => "NaN" , fr_MG => "NaN" , fr_ML => "NaN" , fr_MQ => "NaN" , fr_MR => "NaN" , fr_MU => "NaN" , fr_NC => "NaN" , fr_NE => "NaN" , fr_PF => "NaN" , fr_PM => "NaN" , fr_RE => "NaN" , fr_RW => "NaN" , fr_SC => "NaN" , fr_SN => "NaN" , fr_SY => "NaN" , fr_TD => "NaN" , fr_TG => "NaN" , fr_TN => "NaN" , fr_VU => "NaN" , fr_WF => "NaN" , fr_YT => "NaN" , fur => "NaN" , fy => "NaN" , ga => "NaN" , gd => "NaN" , gl => "NaN" , gsw => "NaN" , gsw_FR => "NaN" , gsw_LI => "NaN" , gu => "NaN" , guz => "NaN" , gv => "NaN" , ha => "NaN" , ha_GH => "NaN" , ha_NE => "NaN" , haw => "NaN" , he => "NaN" , hi => "NaN" , hr => "NaN" , hr_BA => "NaN" , hsb => "NaN" , hu => "NaN" , hy => "\u{548}\u{579}\u{539}" , ia => "NaN" , id => "NaN" , ig => "NaN" , ii => "NaN" , is => "NaN" , it => "NaN" , it_CH => "NaN" , it_SM => "NaN" , it_VA => "NaN" , ja => "NaN" , jgo => "NaN" , jmc => "NaN" , jv => "NaN" , ka => "\u{10d0}\u{10e0}\u{a0}\u{10d0}\u{10e0}\u{10d8}\u{10e1}\u{a0}\u{10e0}\u{10d8}\u{10ea}\u{10ee}\u{10d5}\u{10d8}" , kab => "NaN" , kam => "NaN" , kde => "NaN" , kea => "NaN" , khq => "NaN" , ki => "NaN" , kk => "\u{441}\u{430}\u{43d}\u{a0}\u{435}\u{43c}\u{435}\u{441}" , kkj => "NaN" , kl => "NaN" , kln => "NaN" , km => "NaN" , kn => "NaN" , ko => "NaN" , ko_KP => "NaN" , kok => "NaN" , ks => "NaN" , ksb => "NaN" , ksf => "NaN" , ksh => "\u{a4}\u{a4}\u{a4}" , ku => "NaN" , kw => "NaN" , ky => "\u{441}\u{430}\u{43d}\u{a0}\u{44d}\u{43c}\u{435}\u{441}" , lag => "NaN" , lb => "NaN" , lg => "NaN" , lkt => "NaN" , ln => "NaN" , ln_AO => "NaN" , ln_CF => "NaN" , ln_CG => "NaN" , lo => "\u{e9a}\u{ecd}\u{ec8}\u{200b}\u{ec1}\u{ea1}\u{ec8}\u{e99}\u{200b}\u{ec2}\u{e95}\u{200b}\u{ec0}\u{ea5}\u{e81}" , lrc => "NaN" , lrc_IQ => "NaN" , lt => "NaN" , lu => "NaN" , luo => "NaN" , luy => "NaN" , lv => "NS" , mas => "NaN" , mas_TZ => "NaN" , mer => "NaN" , mfe => "NaN" , mg => "NaN" , mgh => "NaN" , mgo => "NaN" , mi => "NaN" , mk => "NaN" , ml => "NaN" , mn => "NaN" , mr => "NaN" , ms => "NaN" , ms_BN => "NaN" , ms_SG => "NaN" , mt => "NaN" , mua => "NaN" , my => "\u{1002}\u{100f}\u{1014}\u{103a}\u{1038}\u{1019}\u{101f}\u{102f}\u{1010}\u{103a}\u{101e}\u{1031}\u{102c}" , mzn => "NaN" , naq => "NaN" , nb => "NaN" , nb_SJ => "NaN" , nd => "NaN" , nds => "NaN" , nds_NL => "NaN" , ne => "NaN" , ne_IN => "NaN" , nl => "NaN" , nl_AW => "NaN" , nl_BE => "NaN" , nl_BQ => "NaN" , nl_CW => "NaN" , nl_SR => "NaN" , nl_SX => "NaN" , nmg => "NaN" , nn => "NaN" , nnh => "NaN" , nus => "NaN" , nyn => "NaN" , om => "NaN" , om_KE => "NaN" , or => "NaN" , os => "\u{41d}\u{41d}" , os_RU => "\u{41d}\u{41d}" , pa => "NaN" , pa_Arab => "NaN" , pa_Guru => "NaN" , pl => "NaN" , prg => "NaN" , ps => "NaN" , pt => "NaN" , pt_AO => "NaN" , pt_CH => "NaN" , pt_CV => "NaN" , pt_GQ => "NaN" , pt_GW => "NaN" , pt_LU => "NaN" , pt_MO => "NaN" , pt_MZ => "NaN" , pt_PT => "NaN" , pt_ST => "NaN" , pt_TL => "NaN" , qu => "NaN" , qu_BO => "NaN" , qu_EC => "NaN" , rm => "NaN" , rn => "NaN" , ro => "NaN" , ro_MD => "NaN" , rof => "NaN" , root => "NaN" , ru => "\u{43d}\u{435}\u{a0}\u{447}\u{438}\u{441}\u{43b}\u{43e}" , ru_BY => "\u{43d}\u{435}\u{a0}\u{447}\u{438}\u{441}\u{43b}\u{43e}" , ru_KG => "\u{43d}\u{435}\u{a0}\u{447}\u{438}\u{441}\u{43b}\u{43e}" , ru_KZ => "\u{43d}\u{435}\u{a0}\u{447}\u{438}\u{441}\u{43b}\u{43e}" , ru_MD => "\u{43d}\u{435}\u{a0}\u{447}\u{438}\u{441}\u{43b}\u{43e}" , ru_UA => "\u{43d}\u{435}\u{a0}\u{447}\u{438}\u{441}\u{43b}\u{43e}" , rw => "NaN" , rwk => "NaN" , sah => "\u{447}\u{44b}\u{44b}\u{4bb}\u{44b}\u{43b}\u{430}\u{a0}\u{431}\u{443}\u{43e}\u{442}\u{430}\u{445}" , saq => "NaN" , sbp => "NaN" , sd => "NaN" , se => "\u{a4}\u{a4}\u{a4}" , se_FI => "\u{a4}\u{a4}\u{a4}" , se_SE => "\u{a4}\u{a4}\u{a4}" , seh => "NaN" , ses => "NaN" , sg => "NaN" , shi => "NaN" , shi_Latn => "NaN" , shi_Tfng => "NaN" , si => "NaN" , sk => "NaN" , sl => "NaN" , smn => "epiloho" , sn => "NaN" , so => "NaN" , so_DJ => "NaN" , so_ET => "NaN" , so_KE => "NaN" , sq => "NaN" , sq_MK => "NaN" , sq_XK => "NaN" , sr => "NaN" , sr_Cyrl => "NaN" , sr_Cyrl_BA => "NaN" , sr_Cyrl_ME => "NaN" , sr_Cyrl_XK => "NaN" , sr_Latn => "NaN" , sr_Latn_BA => "NaN" , sr_Latn_ME => "NaN" , sr_Latn_XK => "NaN" , sv => "\u{a4}\u{a4}\u{a4}" , sv_AX => "\u{a4}\u{a4}\u{a4}" , sv_FI => "\u{a4}\u{a4}\u{a4}" , sw => "NaN" , sw_CD => "NaN" , sw_KE => "NaN" , sw_UG => "NaN" , ta => "NaN" , ta_LK => "NaN" , ta_MY => "NaN" , ta_SG => "NaN" , te => "NaN" , teo => "NaN" , teo_KE => "NaN" , tg => "NaN" , th => "NaN" , ti => "NaN" , ti_ER => "NaN" , tk => "san\u{a0}d\u{e4}l" , to => "TF" , tr => "NaN" , tr_CY => "NaN" , tt => "NaN" , twq => "NaN" , tzm => "NaN" , ug => "NaN" , uk => "NaN" , ur => "NaN" , ur_IN => "NaN" , uz => "son\u{a0}emas" , uz_Arab => "NaN" , uz_Cyrl => "\u{4b3}\u{430}\u{49b}\u{438}\u{49b}\u{438}\u{439}\u{a0}\u{441}\u{43e}\u{43d}\u{a0}\u{44d}\u{43c}\u{430}\u{441}" , uz_Latn => "son\u{a0}emas" , vai => "NaN" , vai_Latn => "NaN" , vai_Vaii => "NaN" , vi => "NaN" , vo => "NaN" , vun => "NaN" , wae => "NaN" , wo => "NaN" , xh => "NaN" , xog => "NaN" , yav => "NaN" , yi => "NaN" , yo => "NaN" , yo_BJ => "NaN" , yue => "\u{975e}\u{6578}\u{503c}" , yue_Hans => "\u{975e}\u{6570}\u{503c}" , yue_Hant => "\u{975e}\u{6578}\u{503c}" , zgh => "NaN" , zh => "NaN" , zh_Hans => "NaN" , zh_Hans_HK => "NaN" , zh_Hans_MO => "NaN" , zh_Hans_SG => "NaN" , zh_Hant => "\u{975e}\u{6578}\u{503c}" , zh_Hant_HK => "\u{975e}\u{6578}\u{503c}" , zh_Hant_MO => "\u{975e}\u{6578}\u{503c}" , zu => "NaN" , } + match self { + af => "NaN", + af_NA => "NaN", + agq => "NaN", + ak => "NaN", + am => "NaN", + ar => "ليس\u{a0}رقم", + ar_AE => "ليس\u{a0}رقم", + ar_BH => "ليس\u{a0}رقم", + ar_DJ => "ليس\u{a0}رقم", + ar_DZ => "ليس\u{a0}رقم\u{64b}ا", + ar_EG => "ليس\u{a0}رقم", + ar_EH => "ليس\u{a0}رقم\u{64b}ا", + ar_ER => "ليس\u{a0}رقم", + ar_IL => "ليس\u{a0}رقم", + ar_IQ => "ليس\u{a0}رقم", + ar_JO => "ليس\u{a0}رقم", + ar_KM => "ليس\u{a0}رقم", + ar_KW => "ليس\u{a0}رقم", + ar_LB => "ليس\u{a0}رقم", + ar_LY => "ليس\u{a0}رقم\u{64b}ا", + ar_MA => "ليس\u{a0}رقم\u{64b}ا", + ar_MR => "ليس\u{a0}رقم", + ar_OM => "ليس\u{a0}رقم", + ar_PS => "ليس\u{a0}رقم", + ar_QA => "ليس\u{a0}رقم", + ar_SA => "ليس\u{a0}رقم", + ar_SD => "ليس\u{a0}رقم", + ar_SO => "ليس\u{a0}رقم", + ar_SS => "ليس\u{a0}رقم", + ar_SY => "ليس\u{a0}رقم", + ar_TD => "ليس\u{a0}رقم", + ar_TN => "ليس\u{a0}رقم\u{64b}ا", + ar_YE => "ليس\u{a0}رقم", + as_ => "NaN", + asa => "NaN", + ast => "ND", + az => "NaN", + az_Cyrl => "NaN", + az_Latn => "NaN", + bas => "NaN", + be => "NaN", + bem => "NaN", + bez => "NaN", + bg => "NaN", + bm => "NaN", + bn => "NaN", + bn_IN => "NaN", + bo => "NaN", + bo_IN => "NaN", + br => "NaN", + brx => "NaN", + bs => "NaN", + bs_Cyrl => "NaN", + bs_Latn => "NaN", + ca => "NaN", + ca_AD => "NaN", + ca_ES_VALENCIA => "NaN", + ca_FR => "NaN", + ca_IT => "NaN", + ccp => "NaN", + ccp_IN => "NaN", + ce => "Терхьаш\u{a0}дац", + ceb => "NaN", + cgg => "NaN", + chr => "NaN", + ckb => "NaN", + ckb_IR => "NaN", + cs => "NaN", + cu => "NaN", + cy => "NaN", + da => "NaN", + da_GL => "NaN", + dav => "NaN", + de => "NaN", + de_AT => "NaN", + de_BE => "NaN", + de_CH => "NaN", + de_IT => "NaN", + de_LI => "NaN", + de_LU => "NaN", + dje => "NaN", + dsb => "NaN", + dua => "NaN", + dyo => "NaN", + dz => "ཨང་མད", + ebu => "NaN", + ee => "mnn", + ee_TG => "mnn", + el => "NaN", + el_CY => "NaN", + en => "NaN", + en_001 => "NaN", + en_150 => "NaN", + en_AE => "NaN", + en_AG => "NaN", + en_AI => "NaN", + en_AS => "NaN", + en_AT => "NaN", + en_AU => "NaN", + en_BB => "NaN", + en_BE => "NaN", + en_BI => "NaN", + en_BM => "NaN", + en_BS => "NaN", + en_BW => "NaN", + en_BZ => "NaN", + en_CA => "NaN", + en_CC => "NaN", + en_CH => "NaN", + en_CK => "NaN", + en_CM => "NaN", + en_CX => "NaN", + en_CY => "NaN", + en_DE => "NaN", + en_DG => "NaN", + en_DK => "NaN", + en_DM => "NaN", + en_ER => "NaN", + en_FI => "NaN", + en_FJ => "NaN", + en_FK => "NaN", + en_FM => "NaN", + en_GB => "NaN", + en_GD => "NaN", + en_GG => "NaN", + en_GH => "NaN", + en_GI => "NaN", + en_GM => "NaN", + en_GU => "NaN", + en_GY => "NaN", + en_HK => "NaN", + en_IE => "NaN", + en_IL => "NaN", + en_IM => "NaN", + en_IN => "NaN", + en_IO => "NaN", + en_JE => "NaN", + en_JM => "NaN", + en_KE => "NaN", + en_KI => "NaN", + en_KN => "NaN", + en_KY => "NaN", + en_LC => "NaN", + en_LR => "NaN", + en_LS => "NaN", + en_MG => "NaN", + en_MH => "NaN", + en_MO => "NaN", + en_MP => "NaN", + en_MS => "NaN", + en_MT => "NaN", + en_MU => "NaN", + en_MW => "NaN", + en_MY => "NaN", + en_NA => "NaN", + en_NF => "NaN", + en_NG => "NaN", + en_NL => "NaN", + en_NR => "NaN", + en_NU => "NaN", + en_NZ => "NaN", + en_PG => "NaN", + en_PH => "NaN", + en_PK => "NaN", + en_PN => "NaN", + en_PR => "NaN", + en_PW => "NaN", + en_RW => "NaN", + en_SB => "NaN", + en_SC => "NaN", + en_SD => "NaN", + en_SE => "NaN", + en_SG => "NaN", + en_SH => "NaN", + en_SI => "NaN", + en_SL => "NaN", + en_SS => "NaN", + en_SX => "NaN", + en_SZ => "NaN", + en_TC => "NaN", + en_TK => "NaN", + en_TO => "NaN", + en_TT => "NaN", + en_TV => "NaN", + en_TZ => "NaN", + en_UG => "NaN", + en_UM => "NaN", + en_US_POSIX => "NaN", + en_VC => "NaN", + en_VG => "NaN", + en_VI => "NaN", + en_VU => "NaN", + en_WS => "NaN", + en_ZA => "NaN", + en_ZM => "NaN", + en_ZW => "NaN", + eo => "NaN", + es => "NaN", + es_419 => "NaN", + es_AR => "NaN", + es_BO => "NaN", + es_BR => "NaN", + es_BZ => "NaN", + es_CL => "NaN", + es_CO => "NaN", + es_CR => "NaN", + es_CU => "NaN", + es_DO => "NaN", + es_EA => "NaN", + es_EC => "NaN", + es_GQ => "NaN", + es_GT => "NaN", + es_HN => "NaN", + es_IC => "NaN", + es_MX => "NaN", + es_NI => "NaN", + es_PA => "NaN", + es_PE => "NaN", + es_PH => "NaN", + es_PR => "NaN", + es_PY => "NaN", + es_SV => "NaN", + es_US => "NaN", + es_UY => "NaN", + es_VE => "NaN", + et => "NaN", + eu => "NaN", + ewo => "NaN", + fa => "ناعدد", + fa_AF => "ناعدد", + ff => "NaN", + ff_Latn => "NaN", + ff_Latn_BF => "NaN", + ff_Latn_CM => "NaN", + ff_Latn_GH => "NaN", + ff_Latn_GM => "NaN", + ff_Latn_GN => "NaN", + ff_Latn_GW => "NaN", + ff_Latn_LR => "NaN", + ff_Latn_MR => "NaN", + ff_Latn_NE => "NaN", + ff_Latn_NG => "NaN", + ff_Latn_SL => "NaN", + fi => "epäluku", + fil => "NaN", + fo => "NaN", + fo_DK => "NaN", + fr => "NaN", + fr_BE => "NaN", + fr_BF => "NaN", + fr_BI => "NaN", + fr_BJ => "NaN", + fr_BL => "NaN", + fr_CA => "NaN", + fr_CD => "NaN", + fr_CF => "NaN", + fr_CG => "NaN", + fr_CH => "NaN", + fr_CI => "NaN", + fr_CM => "NaN", + fr_DJ => "NaN", + fr_DZ => "NaN", + fr_GA => "NaN", + fr_GF => "NaN", + fr_GN => "NaN", + fr_GP => "NaN", + fr_GQ => "NaN", + fr_HT => "NaN", + fr_KM => "NaN", + fr_LU => "NaN", + fr_MA => "NaN", + fr_MC => "NaN", + fr_MF => "NaN", + fr_MG => "NaN", + fr_ML => "NaN", + fr_MQ => "NaN", + fr_MR => "NaN", + fr_MU => "NaN", + fr_NC => "NaN", + fr_NE => "NaN", + fr_PF => "NaN", + fr_PM => "NaN", + fr_RE => "NaN", + fr_RW => "NaN", + fr_SC => "NaN", + fr_SN => "NaN", + fr_SY => "NaN", + fr_TD => "NaN", + fr_TG => "NaN", + fr_TN => "NaN", + fr_VU => "NaN", + fr_WF => "NaN", + fr_YT => "NaN", + fur => "NaN", + fy => "NaN", + ga => "NaN", + ga_GB => "NaN", + gd => "NaN", + gl => "NaN", + gsw => "NaN", + gsw_FR => "NaN", + gsw_LI => "NaN", + gu => "NaN", + guz => "NaN", + gv => "NaN", + ha => "NaN", + ha_GH => "NaN", + ha_NE => "NaN", + haw => "NaN", + he => "NaN", + hi => "NaN", + hr => "NaN", + hr_BA => "NaN", + hsb => "NaN", + hu => "NaN", + hy => "ՈչԹ", + ia => "NaN", + id => "NaN", + ig => "NaN", + ii => "NaN", + is => "NaN", + it => "NaN", + it_CH => "NaN", + it_SM => "NaN", + it_VA => "NaN", + ja => "NaN", + jgo => "NaN", + jmc => "NaN", + jv => "NaN", + ka => "არ\u{a0}არის\u{a0}რიცხვი", + kab => "NaN", + kam => "NaN", + kde => "NaN", + kea => "NaN", + khq => "NaN", + ki => "NaN", + kk => "сан\u{a0}емес", + kkj => "NaN", + kl => "NaN", + kln => "NaN", + km => "NaN", + kn => "NaN", + ko => "NaN", + ko_KP => "NaN", + kok => "NaN", + ks => "NaN", + ksb => "NaN", + ksf => "NaN", + ksh => "NaN", + ku => "NaN", + kw => "NaN", + ky => "сан\u{a0}эмес", + lag => "NaN", + lb => "NaN", + lg => "NaN", + lkt => "NaN", + ln => "NaN", + ln_AO => "NaN", + ln_CF => "NaN", + ln_CG => "NaN", + lo => "ບ\u{ecd}\u{ec8}\u{200b}ແມ\u{ec8}ນ\u{200b}ໂຕ\u{200b}ເລກ", + lrc => "NaN", + lrc_IQ => "NaN", + lt => "NaN", + lu => "NaN", + luo => "NaN", + luy => "NaN", + lv => "NS", + mas => "NaN", + mas_TZ => "NaN", + mer => "NaN", + mfe => "NaN", + mg => "NaN", + mgh => "NaN", + mgo => "NaN", + mi => "NaN", + mk => "NaN", + ml => "NaN", + mn => "NaN", + mr => "NaN", + ms => "NaN", + ms_BN => "NaN", + ms_SG => "NaN", + mt => "NaN", + mua => "NaN", + my => "ဂဏန\u{103a}းမဟ\u{102f}တ\u{103a}သော", + mzn => "NaN", + naq => "NaN", + nb => "NaN", + nb_SJ => "NaN", + nd => "NaN", + nds => "NaN", + nds_NL => "NaN", + ne => "NaN", + ne_IN => "NaN", + nl => "NaN", + nl_AW => "NaN", + nl_BE => "NaN", + nl_BQ => "NaN", + nl_CW => "NaN", + nl_SR => "NaN", + nl_SX => "NaN", + nmg => "NaN", + nn => "NaN", + nnh => "NaN", + nus => "NaN", + nyn => "NaN", + om => "NaN", + om_KE => "NaN", + or => "NaN", + os => "НН", + os_RU => "НН", + pa => "NaN", + pa_Arab => "NaN", + pa_Guru => "NaN", + pl => "NaN", + prg => "NaN", + ps => "NaN", + ps_PK => "NaN", + pt => "NaN", + pt_AO => "NaN", + pt_CH => "NaN", + pt_CV => "NaN", + pt_GQ => "NaN", + pt_GW => "NaN", + pt_LU => "NaN", + pt_MO => "NaN", + pt_MZ => "NaN", + pt_PT => "NaN", + pt_ST => "NaN", + pt_TL => "NaN", + qu => "NaN", + qu_BO => "NaN", + qu_EC => "NaN", + rm => "NaN", + rn => "NaN", + ro => "NaN", + ro_MD => "NaN", + rof => "NaN", + root => "NaN", + ru => "не\u{a0}число", + ru_BY => "не\u{a0}число", + ru_KG => "не\u{a0}число", + ru_KZ => "не\u{a0}число", + ru_MD => "не\u{a0}число", + ru_UA => "не\u{a0}число", + rw => "NaN", + rwk => "NaN", + sah => "чыыһыла\u{a0}буотах", + saq => "NaN", + sbp => "NaN", + sd => "NaN", + se => "NaN", + se_FI => "NaN", + se_SE => "NaN", + seh => "NaN", + ses => "NaN", + sg => "NaN", + shi => "NaN", + shi_Latn => "NaN", + shi_Tfng => "NaN", + si => "NaN", + sk => "NaN", + sl => "NaN", + smn => "epiloho", + sn => "NaN", + so => "MaL", + so_DJ => "MaL", + so_ET => "MaL", + so_KE => "MaL", + sq => "NaN", + sq_MK => "NaN", + sq_XK => "NaN", + sr => "NaN", + sr_Cyrl => "NaN", + sr_Cyrl_BA => "NaN", + sr_Cyrl_ME => "NaN", + sr_Cyrl_XK => "NaN", + sr_Latn => "NaN", + sr_Latn_BA => "NaN", + sr_Latn_ME => "NaN", + sr_Latn_XK => "NaN", + sv => "NaN", + sv_AX => "NaN", + sv_FI => "NaN", + sw => "NaN", + sw_CD => "NaN", + sw_KE => "NaN", + sw_UG => "NaN", + ta => "NaN", + ta_LK => "NaN", + ta_MY => "NaN", + ta_SG => "NaN", + te => "NaN", + teo => "NaN", + teo_KE => "NaN", + tg => "NaN", + th => "NaN", + ti => "NaN", + ti_ER => "NaN", + tk => "san\u{a0}däl", + to => "TF", + tr => "NaN", + tr_CY => "NaN", + tt => "NaN", + twq => "NaN", + tzm => "NaN", + ug => "NaN", + uk => "NaN", + ur => "NaN", + ur_IN => "NaN", + uz => "son\u{a0}emas", + uz_Arab => "NaN", + uz_Cyrl => "ҳақиқий\u{a0}сон\u{a0}эмас", + uz_Latn => "son\u{a0}emas", + vai => "NaN", + vai_Latn => "NaN", + vai_Vaii => "NaN", + vi => "NaN", + vo => "NaN", + vun => "NaN", + wae => "NaN", + wo => "NaN", + xh => "NaN", + xog => "NaN", + yav => "NaN", + yi => "NaN", + yo => "NaN", + yo_BJ => "NaN", + yue => "非數值", + yue_Hans => "非数值", + yue_Hant => "非數值", + zgh => "NaN", + zh => "NaN", + zh_Hans => "NaN", + zh_Hans_HK => "NaN", + zh_Hans_MO => "NaN", + zh_Hans_SG => "NaN", + zh_Hant => "非數值", + zh_Hant_HK => "非數值", + zh_Hant_MO => "非數值", + zu => "NaN", + } } #[doc = r" Returns the locale's plus sign representation."] pub fn plus_sign(&self) -> &'static str { @@ -3925,6 +4496,7 @@ impl Locale { ccp => "+", ccp_IN => "+", ce => "+", + ceb => "+", cgg => "+", chr => "+", ckb => "\u{200f}+", @@ -3955,6 +4527,7 @@ impl Locale { en => "+", en_001 => "+", en_150 => "+", + en_AE => "+", en_AG => "+", en_AI => "+", en_AS => "+", @@ -4157,6 +4730,7 @@ impl Locale { fur => "+", fy => "+", ga => "+", + ga_GB => "+", gd => "+", gl => "+", gsw => "+", @@ -4278,6 +4852,7 @@ impl Locale { pl => "+", prg => "+", ps => "\u{200e}+\u{200e}", + ps_PK => "\u{200e}+\u{200e}", pt => "+", pt_AO => "+", pt_CH => "+", @@ -4412,34 +4987,34 @@ impl Locale { agq => "\u{a0}", ak => ",", am => ",", - ar => "\u{66c}", - ar_AE => "\u{66c}", - ar_BH => "\u{66c}", - ar_DJ => "\u{66c}", + ar => "٬", + ar_AE => "٬", + ar_BH => "٬", + ar_DJ => "٬", ar_DZ => ".", - ar_EG => "\u{66c}", + ar_EG => "٬", ar_EH => ",", - ar_ER => "\u{66c}", - ar_IL => "\u{66c}", - ar_IQ => "\u{66c}", - ar_JO => "\u{66c}", - ar_KM => "\u{66c}", - ar_KW => "\u{66c}", - ar_LB => "\u{66c}", + ar_ER => "٬", + ar_IL => "٬", + ar_IQ => "٬", + ar_JO => "٬", + ar_KM => "٬", + ar_KW => "٬", + ar_LB => "٬", ar_LY => ".", ar_MA => ".", - ar_MR => "\u{66c}", - ar_OM => "\u{66c}", - ar_PS => "\u{66c}", - ar_QA => "\u{66c}", - ar_SA => "\u{66c}", - ar_SD => "\u{66c}", - ar_SO => "\u{66c}", - ar_SS => "\u{66c}", - ar_SY => "\u{66c}", - ar_TD => "\u{66c}", + ar_MR => "٬", + ar_OM => "٬", + ar_PS => "٬", + ar_QA => "٬", + ar_SA => "٬", + ar_SD => "٬", + ar_SO => "٬", + ar_SS => "٬", + ar_SY => "٬", + ar_TD => "٬", ar_TN => ".", - ar_YE => "\u{66c}", + ar_YE => "٬", as_ => ",", asa => ",", ast => ".", @@ -4469,10 +5044,11 @@ impl Locale { ccp => ",", ccp_IN => ",", ce => ",", + ceb => ",", cgg => ",", chr => ",", - ckb => "\u{66c}", - ckb_IR => "\u{66c}", + ckb => "٬", + ckb_IR => "٬", cs => "\u{a0}", cu => ",", cy => ",", @@ -4482,9 +5058,9 @@ impl Locale { de => ".", de_AT => "\u{a0}", de_BE => ".", - de_CH => "\u{2019}", + de_CH => "’", de_IT => ".", - de_LI => "\u{2019}", + de_LI => "’", de_LU => ".", dje => "\u{a0}", dsb => ".", @@ -4498,7 +5074,8 @@ impl Locale { el_CY => ".", en => ",", en_001 => ",", - en_150 => ".", + en_150 => ",", + en_AE => ",", en_AG => ",", en_AI => ",", en_AS => ",", @@ -4513,7 +5090,7 @@ impl Locale { en_BZ => ",", en_CA => ",", en_CC => ",", - en_CH => ".", + en_CH => "’", en_CK => ",", en_CM => ",", en_CX => ",", @@ -4633,8 +5210,8 @@ impl Locale { et => "\u{a0}", eu => ".", ewo => "\u{a0}", - fa => "\u{66c}", - fa_AF => "\u{66c}", + fa => "٬", + fa_AF => "٬", ff => "\u{a0}", ff_Latn => "\u{a0}", ff_Latn_BF => "\u{a0}", @@ -4701,11 +5278,12 @@ impl Locale { fur => ".", fy => ".", ga => ",", + ga_GB => ",", gd => ",", gl => ".", - gsw => "\u{2019}", - gsw_FR => "\u{2019}", - gsw_LI => "\u{2019}", + gsw => "’", + gsw_FR => "’", + gsw_LI => "’", gu => ",", guz => ",", gv => ",", @@ -4726,7 +5304,7 @@ impl Locale { ii => ",", is => ".", it => ".", - it_CH => "\u{2019}", + it_CH => "’", it_SM => ".", it_VA => ".", ja => ",", @@ -4749,7 +5327,7 @@ impl Locale { ko => ",", ko_KP => ",", kok => ",", - ks => "\u{66c}", + ks => "٬", ksb => ",", ksf => "\u{a0}", ksh => "\u{a0}", @@ -4765,8 +5343,8 @@ impl Locale { ln_CF => ".", ln_CG => ".", lo => ".", - lrc => "\u{66c}", - lrc_IQ => "\u{66c}", + lrc => "٬", + lrc_IQ => "٬", lt => "\u{a0}", lu => ".", luo => ",", @@ -4790,7 +5368,7 @@ impl Locale { mt => ",", mua => ".", my => ",", - mzn => "\u{66c}", + mzn => "٬", naq => ",", nb => "\u{a0}", nb_SJ => "\u{a0}", @@ -4817,11 +5395,12 @@ impl Locale { os => "\u{a0}", os_RU => "\u{a0}", pa => ",", - pa_Arab => "\u{66c}", + pa_Arab => "٬", pa_Guru => ",", pl => "\u{a0}", prg => ",", - ps => "\u{66c}", + ps => "٬", + ps_PK => "٬", pt => ".", pt_AO => "\u{a0}", pt_CH => "\u{a0}", @@ -4837,7 +5416,7 @@ impl Locale { qu => ",", qu_BO => ".", qu_EC => ",", - rm => "\u{2019}", + rm => "’", rn => ".", ro => ".", ro_MD => ".", @@ -4854,7 +5433,7 @@ impl Locale { sah => "\u{a0}", saq => ",", sbp => ",", - sd => "\u{66c}", + sd => "٬", se => "\u{a0}", se_FI => "\u{a0}", se_SE => "\u{a0}", @@ -4913,9 +5492,9 @@ impl Locale { ug => ",", uk => "\u{a0}", ur => ",", - ur_IN => "\u{66c}", + ur_IN => "٬", uz => "\u{a0}", - uz_Arab => "\u{66c}", + uz_Arab => "٬", uz_Cyrl => "\u{a0}", uz_Latn => "\u{a0}", vai => ",", @@ -4924,7 +5503,7 @@ impl Locale { vi => ".", vo => ",", vun => ",", - wae => "\u{2019}", + wae => "’", wo => ".", xh => "\u{a0}", xog => ",", @@ -4988,43 +5567,73 @@ impl FromStr for Locale { let locale = match s { "af" => af, "af-NA" => af_NA, + "af_NA" => af_NA, "agq" => agq, "ak" => ak, "am" => am, "ar" => ar, "ar-AE" => ar_AE, + "ar_AE" => ar_AE, "ar-BH" => ar_BH, + "ar_BH" => ar_BH, "ar-DJ" => ar_DJ, + "ar_DJ" => ar_DJ, "ar-DZ" => ar_DZ, + "ar_DZ" => ar_DZ, "ar-EG" => ar_EG, + "ar_EG" => ar_EG, "ar-EH" => ar_EH, + "ar_EH" => ar_EH, "ar-ER" => ar_ER, + "ar_ER" => ar_ER, "ar-IL" => ar_IL, + "ar_IL" => ar_IL, "ar-IQ" => ar_IQ, + "ar_IQ" => ar_IQ, "ar-JO" => ar_JO, + "ar_JO" => ar_JO, "ar-KM" => ar_KM, + "ar_KM" => ar_KM, "ar-KW" => ar_KW, + "ar_KW" => ar_KW, "ar-LB" => ar_LB, + "ar_LB" => ar_LB, "ar-LY" => ar_LY, + "ar_LY" => ar_LY, "ar-MA" => ar_MA, + "ar_MA" => ar_MA, "ar-MR" => ar_MR, + "ar_MR" => ar_MR, "ar-OM" => ar_OM, + "ar_OM" => ar_OM, "ar-PS" => ar_PS, + "ar_PS" => ar_PS, "ar-QA" => ar_QA, + "ar_QA" => ar_QA, "ar-SA" => ar_SA, + "ar_SA" => ar_SA, "ar-SD" => ar_SD, + "ar_SD" => ar_SD, "ar-SO" => ar_SO, + "ar_SO" => ar_SO, "ar-SS" => ar_SS, + "ar_SS" => ar_SS, "ar-SY" => ar_SY, + "ar_SY" => ar_SY, "ar-TD" => ar_TD, + "ar_TD" => ar_TD, "ar-TN" => ar_TN, + "ar_TN" => ar_TN, "ar-YE" => ar_YE, + "ar_YE" => ar_YE, "as" => as_, "asa" => asa, "ast" => ast, "az" => az, "az-Cyrl" => az_Cyrl, + "az_Cyrl" => az_Cyrl, "az-Latn" => az_Latn, + "az_Latn" => az_Latn, "bas" => bas, "be" => be, "bem" => bem, @@ -5033,38 +5642,56 @@ impl FromStr for Locale { "bm" => bm, "bn" => bn, "bn-IN" => bn_IN, + "bn_IN" => bn_IN, "bo" => bo, "bo-IN" => bo_IN, + "bo_IN" => bo_IN, "br" => br, "brx" => brx, "bs" => bs, "bs-Cyrl" => bs_Cyrl, + "bs_Cyrl" => bs_Cyrl, "bs-Latn" => bs_Latn, + "bs_Latn" => bs_Latn, "ca" => ca, "ca-AD" => ca_AD, + "ca_AD" => ca_AD, "ca-ES-VALENCIA" => ca_ES_VALENCIA, + "ca_ES_VALENCIA" => ca_ES_VALENCIA, "ca-FR" => ca_FR, + "ca_FR" => ca_FR, "ca-IT" => ca_IT, + "ca_IT" => ca_IT, "ccp" => ccp, "ccp-IN" => ccp_IN, + "ccp_IN" => ccp_IN, "ce" => ce, + "ceb" => ceb, "cgg" => cgg, "chr" => chr, "ckb" => ckb, "ckb-IR" => ckb_IR, + "ckb_IR" => ckb_IR, "cs" => cs, "cu" => cu, "cy" => cy, "da" => da, "da-GL" => da_GL, + "da_GL" => da_GL, "dav" => dav, "de" => de, "de-AT" => de_AT, + "de_AT" => de_AT, "de-BE" => de_BE, + "de_BE" => de_BE, "de-CH" => de_CH, + "de_CH" => de_CH, "de-IT" => de_IT, + "de_IT" => de_IT, "de-LI" => de_LI, + "de_LI" => de_LI, "de-LU" => de_LU, + "de_LU" => de_LU, "dje" => dje, "dsb" => dsb, "dua" => dua, @@ -5073,229 +5700,430 @@ impl FromStr for Locale { "ebu" => ebu, "ee" => ee, "ee-TG" => ee_TG, + "ee_TG" => ee_TG, "el" => el, "el-CY" => el_CY, + "el_CY" => el_CY, "en" => en, "en-001" => en_001, + "en_001" => en_001, "en-150" => en_150, + "en_150" => en_150, + "en-AE" => en_AE, + "en_AE" => en_AE, "en-AG" => en_AG, + "en_AG" => en_AG, "en-AI" => en_AI, + "en_AI" => en_AI, "en-AS" => en_AS, + "en_AS" => en_AS, "en-AT" => en_AT, + "en_AT" => en_AT, "en-AU" => en_AU, + "en_AU" => en_AU, "en-BB" => en_BB, + "en_BB" => en_BB, "en-BE" => en_BE, + "en_BE" => en_BE, "en-BI" => en_BI, + "en_BI" => en_BI, "en-BM" => en_BM, + "en_BM" => en_BM, "en-BS" => en_BS, + "en_BS" => en_BS, "en-BW" => en_BW, + "en_BW" => en_BW, "en-BZ" => en_BZ, + "en_BZ" => en_BZ, "en-CA" => en_CA, + "en_CA" => en_CA, "en-CC" => en_CC, + "en_CC" => en_CC, "en-CH" => en_CH, + "en_CH" => en_CH, "en-CK" => en_CK, + "en_CK" => en_CK, "en-CM" => en_CM, + "en_CM" => en_CM, "en-CX" => en_CX, + "en_CX" => en_CX, "en-CY" => en_CY, + "en_CY" => en_CY, "en-DE" => en_DE, + "en_DE" => en_DE, "en-DG" => en_DG, + "en_DG" => en_DG, "en-DK" => en_DK, + "en_DK" => en_DK, "en-DM" => en_DM, + "en_DM" => en_DM, "en-ER" => en_ER, + "en_ER" => en_ER, "en-FI" => en_FI, + "en_FI" => en_FI, "en-FJ" => en_FJ, + "en_FJ" => en_FJ, "en-FK" => en_FK, + "en_FK" => en_FK, "en-FM" => en_FM, + "en_FM" => en_FM, "en-GB" => en_GB, + "en_GB" => en_GB, "en-GD" => en_GD, + "en_GD" => en_GD, "en-GG" => en_GG, + "en_GG" => en_GG, "en-GH" => en_GH, + "en_GH" => en_GH, "en-GI" => en_GI, + "en_GI" => en_GI, "en-GM" => en_GM, + "en_GM" => en_GM, "en-GU" => en_GU, + "en_GU" => en_GU, "en-GY" => en_GY, + "en_GY" => en_GY, "en-HK" => en_HK, + "en_HK" => en_HK, "en-IE" => en_IE, + "en_IE" => en_IE, "en-IL" => en_IL, + "en_IL" => en_IL, "en-IM" => en_IM, + "en_IM" => en_IM, "en-IN" => en_IN, + "en_IN" => en_IN, "en-IO" => en_IO, + "en_IO" => en_IO, "en-JE" => en_JE, + "en_JE" => en_JE, "en-JM" => en_JM, + "en_JM" => en_JM, "en-KE" => en_KE, + "en_KE" => en_KE, "en-KI" => en_KI, + "en_KI" => en_KI, "en-KN" => en_KN, + "en_KN" => en_KN, "en-KY" => en_KY, + "en_KY" => en_KY, "en-LC" => en_LC, + "en_LC" => en_LC, "en-LR" => en_LR, + "en_LR" => en_LR, "en-LS" => en_LS, + "en_LS" => en_LS, "en-MG" => en_MG, + "en_MG" => en_MG, "en-MH" => en_MH, + "en_MH" => en_MH, "en-MO" => en_MO, + "en_MO" => en_MO, "en-MP" => en_MP, + "en_MP" => en_MP, "en-MS" => en_MS, + "en_MS" => en_MS, "en-MT" => en_MT, + "en_MT" => en_MT, "en-MU" => en_MU, + "en_MU" => en_MU, "en-MW" => en_MW, + "en_MW" => en_MW, "en-MY" => en_MY, + "en_MY" => en_MY, "en-NA" => en_NA, + "en_NA" => en_NA, "en-NF" => en_NF, + "en_NF" => en_NF, "en-NG" => en_NG, + "en_NG" => en_NG, "en-NL" => en_NL, + "en_NL" => en_NL, "en-NR" => en_NR, + "en_NR" => en_NR, "en-NU" => en_NU, + "en_NU" => en_NU, "en-NZ" => en_NZ, + "en_NZ" => en_NZ, "en-PG" => en_PG, + "en_PG" => en_PG, "en-PH" => en_PH, + "en_PH" => en_PH, "en-PK" => en_PK, + "en_PK" => en_PK, "en-PN" => en_PN, + "en_PN" => en_PN, "en-PR" => en_PR, + "en_PR" => en_PR, "en-PW" => en_PW, + "en_PW" => en_PW, "en-RW" => en_RW, + "en_RW" => en_RW, "en-SB" => en_SB, + "en_SB" => en_SB, "en-SC" => en_SC, + "en_SC" => en_SC, "en-SD" => en_SD, + "en_SD" => en_SD, "en-SE" => en_SE, + "en_SE" => en_SE, "en-SG" => en_SG, + "en_SG" => en_SG, "en-SH" => en_SH, + "en_SH" => en_SH, "en-SI" => en_SI, + "en_SI" => en_SI, "en-SL" => en_SL, + "en_SL" => en_SL, "en-SS" => en_SS, + "en_SS" => en_SS, "en-SX" => en_SX, + "en_SX" => en_SX, "en-SZ" => en_SZ, + "en_SZ" => en_SZ, "en-TC" => en_TC, + "en_TC" => en_TC, "en-TK" => en_TK, + "en_TK" => en_TK, "en-TO" => en_TO, + "en_TO" => en_TO, "en-TT" => en_TT, + "en_TT" => en_TT, "en-TV" => en_TV, + "en_TV" => en_TV, "en-TZ" => en_TZ, + "en_TZ" => en_TZ, "en-UG" => en_UG, + "en_UG" => en_UG, "en-UM" => en_UM, + "en_UM" => en_UM, "en-US-POSIX" => en_US_POSIX, + "en_US_POSIX" => en_US_POSIX, "en-VC" => en_VC, + "en_VC" => en_VC, "en-VG" => en_VG, + "en_VG" => en_VG, "en-VI" => en_VI, + "en_VI" => en_VI, "en-VU" => en_VU, + "en_VU" => en_VU, "en-WS" => en_WS, + "en_WS" => en_WS, "en-ZA" => en_ZA, + "en_ZA" => en_ZA, "en-ZM" => en_ZM, + "en_ZM" => en_ZM, "en-ZW" => en_ZW, + "en_ZW" => en_ZW, "eo" => eo, "es" => es, "es-419" => es_419, + "es_419" => es_419, "es-AR" => es_AR, + "es_AR" => es_AR, "es-BO" => es_BO, + "es_BO" => es_BO, "es-BR" => es_BR, + "es_BR" => es_BR, "es-BZ" => es_BZ, + "es_BZ" => es_BZ, "es-CL" => es_CL, + "es_CL" => es_CL, "es-CO" => es_CO, + "es_CO" => es_CO, "es-CR" => es_CR, + "es_CR" => es_CR, "es-CU" => es_CU, + "es_CU" => es_CU, "es-DO" => es_DO, + "es_DO" => es_DO, "es-EA" => es_EA, + "es_EA" => es_EA, "es-EC" => es_EC, + "es_EC" => es_EC, "es-GQ" => es_GQ, + "es_GQ" => es_GQ, "es-GT" => es_GT, + "es_GT" => es_GT, "es-HN" => es_HN, + "es_HN" => es_HN, "es-IC" => es_IC, + "es_IC" => es_IC, "es-MX" => es_MX, + "es_MX" => es_MX, "es-NI" => es_NI, + "es_NI" => es_NI, "es-PA" => es_PA, + "es_PA" => es_PA, "es-PE" => es_PE, + "es_PE" => es_PE, "es-PH" => es_PH, + "es_PH" => es_PH, "es-PR" => es_PR, + "es_PR" => es_PR, "es-PY" => es_PY, + "es_PY" => es_PY, "es-SV" => es_SV, + "es_SV" => es_SV, "es-US" => es_US, + "es_US" => es_US, "es-UY" => es_UY, + "es_UY" => es_UY, "es-VE" => es_VE, + "es_VE" => es_VE, "et" => et, "eu" => eu, "ewo" => ewo, "fa" => fa, "fa-AF" => fa_AF, + "fa_AF" => fa_AF, "ff" => ff, "ff-Latn" => ff_Latn, + "ff_Latn" => ff_Latn, "ff-Latn-BF" => ff_Latn_BF, + "ff_Latn_BF" => ff_Latn_BF, "ff-Latn-CM" => ff_Latn_CM, + "ff_Latn_CM" => ff_Latn_CM, "ff-Latn-GH" => ff_Latn_GH, + "ff_Latn_GH" => ff_Latn_GH, "ff-Latn-GM" => ff_Latn_GM, + "ff_Latn_GM" => ff_Latn_GM, "ff-Latn-GN" => ff_Latn_GN, + "ff_Latn_GN" => ff_Latn_GN, "ff-Latn-GW" => ff_Latn_GW, + "ff_Latn_GW" => ff_Latn_GW, "ff-Latn-LR" => ff_Latn_LR, + "ff_Latn_LR" => ff_Latn_LR, "ff-Latn-MR" => ff_Latn_MR, + "ff_Latn_MR" => ff_Latn_MR, "ff-Latn-NE" => ff_Latn_NE, + "ff_Latn_NE" => ff_Latn_NE, "ff-Latn-NG" => ff_Latn_NG, + "ff_Latn_NG" => ff_Latn_NG, "ff-Latn-SL" => ff_Latn_SL, + "ff_Latn_SL" => ff_Latn_SL, "fi" => fi, "fil" => fil, "fo" => fo, "fo-DK" => fo_DK, + "fo_DK" => fo_DK, "fr" => fr, "fr-BE" => fr_BE, + "fr_BE" => fr_BE, "fr-BF" => fr_BF, + "fr_BF" => fr_BF, "fr-BI" => fr_BI, + "fr_BI" => fr_BI, "fr-BJ" => fr_BJ, + "fr_BJ" => fr_BJ, "fr-BL" => fr_BL, + "fr_BL" => fr_BL, "fr-CA" => fr_CA, + "fr_CA" => fr_CA, "fr-CD" => fr_CD, + "fr_CD" => fr_CD, "fr-CF" => fr_CF, + "fr_CF" => fr_CF, "fr-CG" => fr_CG, + "fr_CG" => fr_CG, "fr-CH" => fr_CH, + "fr_CH" => fr_CH, "fr-CI" => fr_CI, + "fr_CI" => fr_CI, "fr-CM" => fr_CM, + "fr_CM" => fr_CM, "fr-DJ" => fr_DJ, + "fr_DJ" => fr_DJ, "fr-DZ" => fr_DZ, + "fr_DZ" => fr_DZ, "fr-GA" => fr_GA, + "fr_GA" => fr_GA, "fr-GF" => fr_GF, + "fr_GF" => fr_GF, "fr-GN" => fr_GN, + "fr_GN" => fr_GN, "fr-GP" => fr_GP, + "fr_GP" => fr_GP, "fr-GQ" => fr_GQ, + "fr_GQ" => fr_GQ, "fr-HT" => fr_HT, + "fr_HT" => fr_HT, "fr-KM" => fr_KM, + "fr_KM" => fr_KM, "fr-LU" => fr_LU, + "fr_LU" => fr_LU, "fr-MA" => fr_MA, + "fr_MA" => fr_MA, "fr-MC" => fr_MC, + "fr_MC" => fr_MC, "fr-MF" => fr_MF, + "fr_MF" => fr_MF, "fr-MG" => fr_MG, + "fr_MG" => fr_MG, "fr-ML" => fr_ML, + "fr_ML" => fr_ML, "fr-MQ" => fr_MQ, + "fr_MQ" => fr_MQ, "fr-MR" => fr_MR, + "fr_MR" => fr_MR, "fr-MU" => fr_MU, + "fr_MU" => fr_MU, "fr-NC" => fr_NC, + "fr_NC" => fr_NC, "fr-NE" => fr_NE, + "fr_NE" => fr_NE, "fr-PF" => fr_PF, + "fr_PF" => fr_PF, "fr-PM" => fr_PM, + "fr_PM" => fr_PM, "fr-RE" => fr_RE, + "fr_RE" => fr_RE, "fr-RW" => fr_RW, + "fr_RW" => fr_RW, "fr-SC" => fr_SC, + "fr_SC" => fr_SC, "fr-SN" => fr_SN, + "fr_SN" => fr_SN, "fr-SY" => fr_SY, + "fr_SY" => fr_SY, "fr-TD" => fr_TD, + "fr_TD" => fr_TD, "fr-TG" => fr_TG, + "fr_TG" => fr_TG, "fr-TN" => fr_TN, + "fr_TN" => fr_TN, "fr-VU" => fr_VU, + "fr_VU" => fr_VU, "fr-WF" => fr_WF, + "fr_WF" => fr_WF, "fr-YT" => fr_YT, + "fr_YT" => fr_YT, "fur" => fur, "fy" => fy, "ga" => ga, + "ga-GB" => ga_GB, + "ga_GB" => ga_GB, "gd" => gd, "gl" => gl, "gsw" => gsw, "gsw-FR" => gsw_FR, + "gsw_FR" => gsw_FR, "gsw-LI" => gsw_LI, + "gsw_LI" => gsw_LI, "gu" => gu, "guz" => guz, "gv" => gv, "ha" => ha, "ha-GH" => ha_GH, + "ha_GH" => ha_GH, "ha-NE" => ha_NE, + "ha_NE" => ha_NE, "haw" => haw, "he" => he, "hi" => hi, "hr" => hr, "hr-BA" => hr_BA, + "hr_BA" => hr_BA, "hsb" => hsb, "hu" => hu, "hy" => hy, @@ -5306,8 +6134,11 @@ impl FromStr for Locale { "is" => is, "it" => it, "it-CH" => it_CH, + "it_CH" => it_CH, "it-SM" => it_SM, + "it_SM" => it_SM, "it-VA" => it_VA, + "it_VA" => it_VA, "ja" => ja, "jgo" => jgo, "jmc" => jmc, @@ -5327,6 +6158,7 @@ impl FromStr for Locale { "kn" => kn, "ko" => ko, "ko-KP" => ko_KP, + "ko_KP" => ko_KP, "kok" => kok, "ks" => ks, "ksb" => ksb, @@ -5341,11 +6173,15 @@ impl FromStr for Locale { "lkt" => lkt, "ln" => ln, "ln-AO" => ln_AO, + "ln_AO" => ln_AO, "ln-CF" => ln_CF, + "ln_CF" => ln_CF, "ln-CG" => ln_CG, + "ln_CG" => ln_CG, "lo" => lo, "lrc" => lrc, "lrc-IQ" => lrc_IQ, + "lrc_IQ" => lrc_IQ, "lt" => lt, "lu" => lu, "luo" => luo, @@ -5353,6 +6189,7 @@ impl FromStr for Locale { "lv" => lv, "mas" => mas, "mas-TZ" => mas_TZ, + "mas_TZ" => mas_TZ, "mer" => mer, "mfe" => mfe, "mg" => mg, @@ -5365,7 +6202,9 @@ impl FromStr for Locale { "mr" => mr, "ms" => ms, "ms-BN" => ms_BN, + "ms_BN" => ms_BN, "ms-SG" => ms_SG, + "ms_SG" => ms_SG, "mt" => mt, "mua" => mua, "my" => my, @@ -5373,18 +6212,27 @@ impl FromStr for Locale { "naq" => naq, "nb" => nb, "nb-SJ" => nb_SJ, + "nb_SJ" => nb_SJ, "nd" => nd, "nds" => nds, "nds-NL" => nds_NL, + "nds_NL" => nds_NL, "ne" => ne, "ne-IN" => ne_IN, + "ne_IN" => ne_IN, "nl" => nl, "nl-AW" => nl_AW, + "nl_AW" => nl_AW, "nl-BE" => nl_BE, + "nl_BE" => nl_BE, "nl-BQ" => nl_BQ, + "nl_BQ" => nl_BQ, "nl-CW" => nl_CW, + "nl_CW" => nl_CW, "nl-SR" => nl_SR, + "nl_SR" => nl_SR, "nl-SX" => nl_SX, + "nl_SX" => nl_SX, "nmg" => nmg, "nn" => nn, "nnh" => nnh, @@ -5392,42 +6240,67 @@ impl FromStr for Locale { "nyn" => nyn, "om" => om, "om-KE" => om_KE, + "om_KE" => om_KE, "or" => or, "os" => os, "os-RU" => os_RU, + "os_RU" => os_RU, "pa" => pa, "pa-Arab" => pa_Arab, + "pa_Arab" => pa_Arab, "pa-Guru" => pa_Guru, + "pa_Guru" => pa_Guru, "pl" => pl, "prg" => prg, "ps" => ps, + "ps-PK" => ps_PK, + "ps_PK" => ps_PK, "pt" => pt, "pt-AO" => pt_AO, + "pt_AO" => pt_AO, "pt-CH" => pt_CH, + "pt_CH" => pt_CH, "pt-CV" => pt_CV, + "pt_CV" => pt_CV, "pt-GQ" => pt_GQ, + "pt_GQ" => pt_GQ, "pt-GW" => pt_GW, + "pt_GW" => pt_GW, "pt-LU" => pt_LU, + "pt_LU" => pt_LU, "pt-MO" => pt_MO, + "pt_MO" => pt_MO, "pt-MZ" => pt_MZ, + "pt_MZ" => pt_MZ, "pt-PT" => pt_PT, + "pt_PT" => pt_PT, "pt-ST" => pt_ST, + "pt_ST" => pt_ST, "pt-TL" => pt_TL, + "pt_TL" => pt_TL, "qu" => qu, "qu-BO" => qu_BO, + "qu_BO" => qu_BO, "qu-EC" => qu_EC, + "qu_EC" => qu_EC, "rm" => rm, "rn" => rn, "ro" => ro, "ro-MD" => ro_MD, + "ro_MD" => ro_MD, "rof" => rof, "root" => root, "ru" => ru, "ru-BY" => ru_BY, + "ru_BY" => ru_BY, "ru-KG" => ru_KG, + "ru_KG" => ru_KG, "ru-KZ" => ru_KZ, + "ru_KZ" => ru_KZ, "ru-MD" => ru_MD, + "ru_MD" => ru_MD, "ru-UA" => ru_UA, + "ru_UA" => ru_UA, "rw" => rw, "rwk" => rwk, "sah" => sah, @@ -5436,13 +6309,17 @@ impl FromStr for Locale { "sd" => sd, "se" => se, "se-FI" => se_FI, + "se_FI" => se_FI, "se-SE" => se_SE, + "se_SE" => se_SE, "seh" => seh, "ses" => ses, "sg" => sg, "shi" => shi, "shi-Latn" => shi_Latn, + "shi_Latn" => shi_Latn, "shi-Tfng" => shi_Tfng, + "shi_Tfng" => shi_Tfng, "si" => si, "sk" => sk, "sl" => sl, @@ -5450,42 +6327,66 @@ impl FromStr for Locale { "sn" => sn, "so" => so, "so-DJ" => so_DJ, + "so_DJ" => so_DJ, "so-ET" => so_ET, + "so_ET" => so_ET, "so-KE" => so_KE, + "so_KE" => so_KE, "sq" => sq, "sq-MK" => sq_MK, + "sq_MK" => sq_MK, "sq-XK" => sq_XK, + "sq_XK" => sq_XK, "sr" => sr, "sr-Cyrl" => sr_Cyrl, + "sr_Cyrl" => sr_Cyrl, "sr-Cyrl-BA" => sr_Cyrl_BA, + "sr_Cyrl_BA" => sr_Cyrl_BA, "sr-Cyrl-ME" => sr_Cyrl_ME, + "sr_Cyrl_ME" => sr_Cyrl_ME, "sr-Cyrl-XK" => sr_Cyrl_XK, + "sr_Cyrl_XK" => sr_Cyrl_XK, "sr-Latn" => sr_Latn, + "sr_Latn" => sr_Latn, "sr-Latn-BA" => sr_Latn_BA, + "sr_Latn_BA" => sr_Latn_BA, "sr-Latn-ME" => sr_Latn_ME, + "sr_Latn_ME" => sr_Latn_ME, "sr-Latn-XK" => sr_Latn_XK, + "sr_Latn_XK" => sr_Latn_XK, "sv" => sv, "sv-AX" => sv_AX, + "sv_AX" => sv_AX, "sv-FI" => sv_FI, + "sv_FI" => sv_FI, "sw" => sw, "sw-CD" => sw_CD, + "sw_CD" => sw_CD, "sw-KE" => sw_KE, + "sw_KE" => sw_KE, "sw-UG" => sw_UG, + "sw_UG" => sw_UG, "ta" => ta, "ta-LK" => ta_LK, + "ta_LK" => ta_LK, "ta-MY" => ta_MY, + "ta_MY" => ta_MY, "ta-SG" => ta_SG, + "ta_SG" => ta_SG, "te" => te, "teo" => teo, "teo-KE" => teo_KE, + "teo_KE" => teo_KE, "tg" => tg, "th" => th, "ti" => ti, "ti-ER" => ti_ER, + "ti_ER" => ti_ER, "tk" => tk, "to" => to, "tr" => tr, "tr-CY" => tr_CY, + "tr_CY" => tr_CY, "tt" => tt, "twq" => twq, "tzm" => tzm, @@ -5493,13 +6394,19 @@ impl FromStr for Locale { "uk" => uk, "ur" => ur, "ur-IN" => ur_IN, + "ur_IN" => ur_IN, "uz" => uz, "uz-Arab" => uz_Arab, + "uz_Arab" => uz_Arab, "uz-Cyrl" => uz_Cyrl, + "uz_Cyrl" => uz_Cyrl, "uz-Latn" => uz_Latn, + "uz_Latn" => uz_Latn, "vai" => vai, "vai-Latn" => vai_Latn, + "vai_Latn" => vai_Latn, "vai-Vaii" => vai_Vaii, + "vai_Vaii" => vai_Vaii, "vi" => vi, "vo" => vo, "vun" => vun, @@ -5511,18 +6418,28 @@ impl FromStr for Locale { "yi" => yi, "yo" => yo, "yo-BJ" => yo_BJ, + "yo_BJ" => yo_BJ, "yue" => yue, "yue-Hans" => yue_Hans, + "yue_Hans" => yue_Hans, "yue-Hant" => yue_Hant, + "yue_Hant" => yue_Hant, "zgh" => zgh, "zh" => zh, "zh-Hans" => zh_Hans, + "zh_Hans" => zh_Hans, "zh-Hans-HK" => zh_Hans_HK, + "zh_Hans_HK" => zh_Hans_HK, "zh-Hans-MO" => zh_Hans_MO, + "zh_Hans_MO" => zh_Hans_MO, "zh-Hans-SG" => zh_Hans_SG, + "zh_Hans_SG" => zh_Hans_SG, "zh-Hant" => zh_Hant, + "zh_Hant" => zh_Hant, "zh-Hant-HK" => zh_Hant_HK, + "zh_Hant_HK" => zh_Hant_HK, "zh-Hant-MO" => zh_Hant_MO, + "zh_Hant_MO" => zh_Hant_MO, "zu" => zu, _ => return Err(Error::parse_locale(s)), }; diff --git a/num-format/src/parsing.rs b/num-format/src/parsing.rs new file mode 100644 index 0000000..71e992b --- /dev/null +++ b/num-format/src/parsing.rs @@ -0,0 +1,218 @@ +//! Module with traits for parsing a formatted string into a number. +//! +//! # Examples +//! ``` +//! use num_format::Locale; +//! use num_format::parsing::ParseFormatted; +//! +//! fn main() { +//! let s = "1,000,000"; +//! let n = s.parse_formatted::<_, u32>(&Locale::en).unwrap(); +//! assert_eq!(n, 1_000_000); +//! } +//! ``` + +use core::num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize}; +use core::str; + +use crate::constants::*; +use crate::error::Error; +use crate::format::Format; +use crate::sealed::Sealed; + +/// Trait that provides string-like types with a [`parse_formatted`] +/// method, allowing conversion from a formatted string into a number. +/// +/// # Examples +/// ``` +/// use num_format::Locale; +/// use num_format::parsing::ParseFormatted; +/// +/// fn main() { +/// let s = "1,000,000"; +/// let n = s.parse_formatted::<_, u32>(&Locale::en).unwrap(); +/// assert_eq!(n, 1_000_000); +/// } +/// ``` +/// +/// [`parse_formatted`]: trait.ParseFormatted.html#method.parse_formatted +pub trait ParseFormatted { + /// Converts `self` (typically a formatted string) into a number (see [Examples] above). + /// + /// [Examples]: trait.ParseFormatted.html#examples + fn parse_formatted(&self, format: &F) -> Result + where + F: Format, + N: FromFormattedStr; +} + +impl ParseFormatted for S +where + S: AsRef, +{ + fn parse_formatted(&self, format: &F) -> Result + where + F: Format, + N: FromFormattedStr, + { + FromFormattedStr::from_formatted_str(self.as_ref(), format) + } +} + +/// Marker trait for number types (e.g. `u32`) that string-like types can be parsed +/// into via the [`ParseFormatted`] trait. +/// +/// This trait is sealed; so you may not implement it on your own types. +/// +/// [`ParseFormatted`]: trait.ParseFormatted.html +pub trait FromFormattedStr: Sealed + Sized { + #[allow(missing_docs)] + fn from_formatted_str(s: &str, format: &F) -> Result + where + F: Format; +} + +macro_rules! impl_from_formatted_str { + ($type:ty, $max_len:expr) => { + impl FromFormattedStr for $type { + fn from_formatted_str(s: &str, format: &F) -> Result + where + F: Format, + { + const BUF_LEN: usize = $max_len; + let mut buf: [u8; BUF_LEN] = [0; BUF_LEN]; + + let minus_sign = format.minus_sign().into_str(); + let is_negative = s.starts_with(minus_sign); + + let mut index = 0; + if is_negative { + buf[index] = '-' as u8; + index += 1; + } + for c in s.chars() { + if c.is_numeric() { + if index > BUF_LEN { + return Err(Error::parse_number(&s)); + } + buf[index] = c as u8; + index += 1; + } + } + + if index == 0 { + return Err(Error::parse_number(&s)); + } + + let s2 = unsafe { str::from_utf8_unchecked(&buf[..index]) }; + let n = s2.parse::<$type>().map_err(|_| Error::parse_locale(&s))?; + + Ok(n) + } + } + }; +} + +impl_from_formatted_str!(u8, U8_MAX_LEN); +impl_from_formatted_str!(u16, U16_MAX_LEN); +impl_from_formatted_str!(u32, U32_MAX_LEN); +impl_from_formatted_str!(usize, USIZE_MAX_LEN); +impl_from_formatted_str!(u64, U64_MAX_LEN); +impl_from_formatted_str!(u128, U128_MAX_LEN); + +impl_from_formatted_str!(i8, I8_MAX_LEN); +impl_from_formatted_str!(i16, I16_MAX_LEN); +impl_from_formatted_str!(i32, I32_MAX_LEN); +impl_from_formatted_str!(isize, ISIZE_MAX_LEN); +impl_from_formatted_str!(i64, I64_MAX_LEN); +impl_from_formatted_str!(i128, I128_MAX_LEN); + +macro_rules! impl_from_formatted_str_non_zero { + ($type:ty, $related_type:ty, $max_len:expr) => { + impl FromFormattedStr for $type { + fn from_formatted_str(s: &str, format: &F) -> Result + where + F: Format, + { + let n = s.parse_formatted::<_, $related_type>(format)?; + let n = Self::new(n).ok_or_else(|| Error::parse_number(s))?; + Ok(n) + } + } + }; +} + +impl_from_formatted_str_non_zero!(NonZeroU8, u8, U8_MAX_LEN); +impl_from_formatted_str_non_zero!(NonZeroU16, u16, U16_MAX_LEN); +impl_from_formatted_str_non_zero!(NonZeroU32, u32, U32_MAX_LEN); +impl_from_formatted_str_non_zero!(NonZeroUsize, usize, USIZE_MAX_LEN); +impl_from_formatted_str_non_zero!(NonZeroU64, u64, U64_MAX_LEN); +impl_from_formatted_str_non_zero!(NonZeroU128, u128, U128_MAX_LEN); + +#[cfg(feature = "with-num-bigint")] +mod num { + use num_bigint::{BigInt, BigUint}; + + use super::*; + + macro_rules! impl_from_formatted_str_num_bigint { + ($type:ty) => { + impl FromFormattedStr for $type { + fn from_formatted_str(s: &str, format: &F) -> Result + where + F: Format, + { + let mut buf = Vec::new(); + + let minus_sign = format.minus_sign().into_str(); + let is_negative = s.starts_with(minus_sign); + + if is_negative { + buf.push('-' as u8); + } + for c in s.chars() { + if c.is_numeric() { + buf.push(c as u8); + } + } + + if buf.is_empty() { + return Err(Error::parse_number(&s)); + } + + let s2 = unsafe { str::from_utf8_unchecked(&buf[..]) }; + let n = s2.parse::<$type>().map_err(|_| Error::parse_locale(&s))?; + + Ok(n) + } + } + }; + } + + impl_from_formatted_str_num_bigint!(BigInt); + impl_from_formatted_str_num_bigint!(BigUint); + + #[cfg(test)] + mod tests { + use num_bigint::{ToBigInt, ToBigUint}; + + use super::*; + use crate::locale::Locale; + + #[test] + fn test_parsing_num_bigint() { + assert_eq!( + "1,000,000" + .parse_formatted::<_, BigUint>(&Locale::en) + .unwrap(), + 1_000_000.to_biguint().unwrap() + ); + assert_eq!( + "-1,000,000" + .parse_formatted::<_, BigInt>(&Locale::en) + .unwrap(), + (-1_000_000).to_bigint().unwrap() + ); + } + } +} diff --git a/num-format/src/strings.rs b/num-format/src/strings.rs index a1b2d52..db40eb7 100644 --- a/num-format/src/strings.rs +++ b/num-format/src/strings.rs @@ -157,13 +157,13 @@ macro_rules! create_impls { } impl<'a> fmt::Debug for $name<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self.0) } } impl<'a> fmt::Display for $name<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) } } @@ -180,7 +180,7 @@ create_impls!(SeparatorStr, MAX_SEP_LEN); macro_rules! create_string { ( $name:ident, $visitor:ident, $max_len:expr ) => { #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] - pub(crate) struct $name(ArrayString<[u8; $max_len]>); + pub(crate) struct $name(ArrayString<$max_len>); impl $name { #[allow(dead_code)] @@ -224,12 +224,12 @@ macro_rules! create_string { } impl fmt::Display for $name { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) } } - impl From<$name> for ArrayString<[u8; $max_len]> { + impl From<$name> for ArrayString<$max_len> { fn from(s: $name) -> Self { s.0 } @@ -252,7 +252,7 @@ macro_rules! create_string { impl<'de> de::Visitor<'de> for $visitor { type Value = $name; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { write!(formatter, "a string containing at most {} bytes", $max_len) } diff --git a/num-format/src/system_locale.rs b/num-format/src/system_locale.rs index f791e18..e732e72 100644 --- a/num-format/src/system_locale.rs +++ b/num-format/src/system_locale.rs @@ -1,6 +1,6 @@ #![cfg(all(feature = "with-system-locale", any(unix, windows)))] -mod unix; +mod nix; mod windows; use std::collections::HashSet; @@ -76,7 +76,7 @@ impl SystemLocale { /// [`SystemLocale`]: struct.SystemLocale.html pub fn default() -> Result { #[cfg(unix)] - return self::unix::new(None); + return self::nix::new(None); #[cfg(windows)] return self::windows::new(None); @@ -100,7 +100,7 @@ impl SystemLocale { S: Into, { #[cfg(unix)] - return self::unix::new(Some(name.into())); + return self::nix::new(Some(name.into())); #[cfg(windows)] return self::windows::new(Some(name.into())); @@ -123,7 +123,7 @@ impl SystemLocale { /// [`locale`]: http://man7.org/linux/man-pages/man1/locale.1.html pub fn available_names() -> Result, Error> { #[cfg(unix)] - return Ok(self::unix::available_names()); + return Ok(self::nix::available_names()); #[cfg(windows)] return self::windows::available_names(); diff --git a/num-format/src/system_locale/unix.rs b/num-format/src/system_locale/nix.rs similarity index 100% rename from num-format/src/system_locale/unix.rs rename to num-format/src/system_locale/nix.rs diff --git a/num-format/src/system_locale/unix/bsd.rs b/num-format/src/system_locale/nix/bsd.rs similarity index 96% rename from num-format/src/system_locale/unix/bsd.rs rename to num-format/src/system_locale/nix/bsd.rs index 48e7bfe..a639c83 100644 --- a/num-format/src/system_locale/unix/bsd.rs +++ b/num-format/src/system_locale/nix/bsd.rs @@ -14,7 +14,7 @@ use libc::{c_char, c_int, c_void}; use crate::error::Error; -use crate::system_locale::unix::{Encoding, Lconv, StaticCString, UTF_8}; +use crate::system_locale::nix::{Encoding, Lconv, StaticCString, UTF_8}; extern "C" { fn localeconv_l(locale: *const c_void) -> *const libc::lconv; diff --git a/num-format/src/system_locale/unix/encoding.rs b/num-format/src/system_locale/nix/encoding.rs similarity index 93% rename from num-format/src/system_locale/unix/encoding.rs rename to num-format/src/system_locale/nix/encoding.rs index 01fc380..644a11d 100644 --- a/num-format/src/system_locale/unix/encoding.rs +++ b/num-format/src/system_locale/nix/encoding.rs @@ -7,13 +7,13 @@ lazy_static! { } // See https://docs.rs/encoding_rs/0.8.16/encoding_rs/ -static LATIN_1: &'static encoding_rs::Encoding = encoding_rs::WINDOWS_1252; +static LATIN_1: &encoding_rs::Encoding = encoding_rs::WINDOWS_1252; #[derive(Copy, Clone, Debug)] pub(crate) struct Encoding(&'static encoding_rs::Encoding); impl Encoding { - pub(crate) fn decode<'a>(&self, bytes: &'a [u8]) -> Result { + pub(crate) fn decode(&self, bytes: &[u8]) -> Result { let (cow, _encoding, is_err) = self.0.decode(bytes); if is_err { return Err(Error::system_invalid_return( diff --git a/num-format/src/system_locale/unix/linux.rs b/num-format/src/system_locale/nix/linux.rs similarity index 95% rename from num-format/src/system_locale/unix/linux.rs rename to num-format/src/system_locale/nix/linux.rs index 02fd0ee..cc502d3 100644 --- a/num-format/src/system_locale/unix/linux.rs +++ b/num-format/src/system_locale/nix/linux.rs @@ -16,7 +16,7 @@ use std::env; use libc::{c_char, c_void}; use crate::error::Error; -use crate::system_locale::unix::{Encoding, Lconv, StaticCString, UTF_8}; +use crate::system_locale::nix::{Encoding, Lconv, StaticCString, UTF_8}; extern "C" { fn localeconv() -> *const libc::lconv; diff --git a/num-format/src/system_locale/windows.rs b/num-format/src/system_locale/windows.rs index a05647c..5097246 100644 --- a/num-format/src/system_locale/windows.rs +++ b/num-format/src/system_locale/windows.rs @@ -3,7 +3,6 @@ use std::borrow::Cow; use std::collections::HashSet; use std::ffi::CStr; -use std::mem; use std::ptr; use std::sync::{Arc, Mutex}; @@ -45,7 +44,7 @@ pub(crate) fn available_names() -> Result, Error> { } pub(crate) fn new(name: Option) -> Result { - let name: Cow = match name { + let name: Cow<'_, str> = match name { Some(name) => name.into(), None => (*SYSTEM_DEFAULT).clone()?.into(), }; @@ -61,12 +60,12 @@ pub(crate) fn new(name: Option) -> Result { Error::system_invalid_return( "get_locale_info_ex", format!( - "get_locale_info_ex function from Windows API unexpectedly returned decimal \ + "get_locale_info_ex function from Windows API unexpectedly returned decimal \ string whose length ({} bytes) exceeds maximum currently supported by num-format \ ({} bytes).", - s.len(), - DecString::capacity(), - ), + s.len(), + DecString::capacity(), + ), ) })? }; @@ -91,12 +90,12 @@ pub(crate) fn new(name: Option) -> Result { Error::system_invalid_return( "get_locale_info_ex", format!( - "get_locale_info_ex function from Windows API unexpectedly returned infinity \ + "get_locale_info_ex function from Windows API unexpectedly returned infinity \ string whose length ({} bytes) exceeds maximum currently supported by num-format \ ({} bytes).", - s.len(), - InfString::capacity(), - ), + s.len(), + InfString::capacity(), + ), ) })? }; @@ -123,12 +122,12 @@ pub(crate) fn new(name: Option) -> Result { Error::system_invalid_return( "get_locale_info_ex", format!( - "get_locale_info_ex function from Windows API unexpectedly returned NaN \ + "get_locale_info_ex function from Windows API unexpectedly returned NaN \ string whose length ({} bytes) exceeds maximum currently supported by num-format \ ({} bytes).", - s.len(), - NanString::capacity(), - ), + s.len(), + NanString::capacity(), + ), ) })? }; @@ -139,12 +138,12 @@ pub(crate) fn new(name: Option) -> Result { Error::system_invalid_return( "get_locale_info_ex", format!( - "get_locale_info_ex function from Windows API unexpectedly returned plus sign \ + "get_locale_info_ex function from Windows API unexpectedly returned plus sign \ string whose length ({} bytes) exceeds maximum currently supported by num-format \ ({} bytes).", - s.len(), - PlusString::capacity(), - ), + s.len(), + PlusString::capacity(), + ), ) })? }; @@ -155,12 +154,12 @@ pub(crate) fn new(name: Option) -> Result { Error::system_invalid_return( "get_locale_info_ex", format!( - "get_locale_info_ex function from Windows API unexpectedly returned separator \ + "get_locale_info_ex function from Windows API unexpectedly returned separator \ string whose length ({} bytes) exceeds maximum currently supported by num-format \ ({} bytes).", - s.len(), - SepString::capacity(), - ), + s.len(), + SepString::capacity(), + ), ) })? }; @@ -250,7 +249,7 @@ fn enum_system_locales_ex() -> Result, Error> { Err(_) => return CONTINUE, }; - if &s == "" { + if s.is_empty() { return CONTINUE; } @@ -258,7 +257,7 @@ fn enum_system_locales_ex() -> Result, Error> { let _ = inner_guard.insert(s); CONTINUE - }; + } let set = { let outer_guard = OUTER_MUTEX.lock().unwrap(); @@ -301,6 +300,7 @@ fn get_locale_info_ex(locale_name: &str, request: Request) -> Result Result { let size = unsafe { winnls::GetLocaleInfoEx(lpLocaleName, LCType, buf_ptr, size) }; + #[allow(clippy::comparison_chain)] if size == 0 { let err = unsafe { GetLastError() }; if err == 87 { @@ -346,7 +346,7 @@ fn get_locale_info_ex(locale_name: &str, request: Request) -> Result Result(&self, buf: &mut Buffer, format: &F) -> usize; + fn read_to_buffer(&self, buf: &mut Buffer, format: &F) -> usize + where + F: Format; } diff --git a/num-format/src/to_formatted_string.rs b/num-format/src/to_formatted_string.rs index 897d9c5..2db4c0b 100644 --- a/num-format/src/to_formatted_string.rs +++ b/num-format/src/to_formatted_string.rs @@ -12,7 +12,7 @@ use crate::{Buffer, Format, ToFormattedStr}; /// This trait is sealed; so you may not implement it on your own types. /// /// [`to_formatted_string`]: trait.ToFormattedString.html#method.to_formatted_string -pub trait ToFormattedString: Sealed { +pub trait ToFormattedString: Sealed + Sized { #[doc(hidden)] fn read_to_fmt_writer(&self, w: W, format: &F) -> Result where diff --git a/num-format/src/write_formatted.rs b/num-format/src/write_formatted.rs index 41d21e9..9245f2e 100644 --- a/num-format/src/write_formatted.rs +++ b/num-format/src/write_formatted.rs @@ -40,7 +40,8 @@ macro_rules! impl_for_fmt_write { F: Format, N: ToFormattedString, { - n.read_to_fmt_writer(self, format).map_err(|e| io::Error::new(io::ErrorKind::Other, e)) + n.read_to_fmt_writer(self, format) + .map_err(|e| io::Error::new(io::ErrorKind::Other, e)) } }; } diff --git a/num-format/tests/test_system_locale_windows.rs b/num-format/tests/test_system_locale_windows.rs index 822b5cc..6839a25 100644 --- a/num-format/tests/test_system_locale_windows.rs +++ b/num-format/tests/test_system_locale_windows.rs @@ -7,6 +7,6 @@ fn test_windows() { let names = SystemLocale::available_names().unwrap(); assert!(!names.is_empty()); for name in &names { - let _ = SystemLocale::from_name(name.as_ref()).unwrap(); + let _ = SystemLocale::from_name(name).unwrap(); } } diff --git a/scripts/bench.sh b/scripts/bench.sh deleted file mode 100755 index 3ece073..0000000 --- a/scripts/bench.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -cargo bench --manifest-path num-format-benches/Cargo.toml diff --git a/scripts/check.sh b/scripts/check.sh deleted file mode 100755 index 795109c..0000000 --- a/scripts/check.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# no_std -cargo check --manifest-path num-format/Cargo.toml --no-default-features -cargo check --manifest-path num-format/Cargo.toml --no-default-features --features "with-serde" - -# std -cargo check --manifest-path num-format/Cargo.toml -cargo check --manifest-path num-format/Cargo.toml --features "with-num-bigint" -cargo check --manifest-path num-format/Cargo.toml --features "with-system-locale" -cargo check --manifest-path num-format/Cargo.toml --features "with-serde with-system-locale" -cargo check --manifest-path num-format/Cargo.toml --no-default-features --all-features diff --git a/scripts/locale.sh b/scripts/locale.sh deleted file mode 100755 index c98c6eb..0000000 --- a/scripts/locale.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -cargo +nightly run --manifest-path num-format-dev/Cargo.toml --features "nightly" \ -|| cargo run --manifest-path num-format-dev/Cargo.toml - -cargo fmt diff --git a/scripts/readme.sh b/scripts/readme.sh deleted file mode 100755 index bb3f65c..0000000 --- a/scripts/readme.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e - -( - cd num-format - cargo readme > README.md -) -cp num-format/README.md ./README.md - -( - cd num-format-windows - cargo readme > README.md -) diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 96645e4..0000000 --- a/scripts/test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -e - -./scripts/check.sh - -# no_std -cargo test --manifest-path num-format/Cargo.toml --no-default-features -cargo test --manifest-path num-format/Cargo.toml --no-default-features --features "with-serde" - -# std -cargo test --manifest-path num-format/Cargo.toml -cargo test --manifest-path num-format/Cargo.toml --features "with-num-bigint" -cargo test --manifest-path num-format/Cargo.toml --features "with-system-locale" -cargo test --manifest-path num-format/Cargo.toml --features "with-serde with-system-locale" -cargo test --manifest-path num-format/Cargo.toml --no-default-features --all-features