Skip to content

Commit

Permalink
Rename to fixed-decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
zbraniecki committed Oct 6, 2020
1 parent 28eace6 commit 49ec298
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/perf-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
component:
- components/locale
- components/uniset
- utils/num
- utils/fixed-decimal

# If you are modifying and debugging is required, don't be afraid to get
# messy in a personal fork, if no better way to do it.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ members = [
"components/locale",
"components/pluralrules",
"components/datetime",
"utils/num",
"utils/fixed-decimal",
]
2 changes: 1 addition & 1 deletion components/pluralrules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include = [
[dependencies]
icu-locale = { path = "../locale" }
icu-data-provider = { path = "../data-provider" }
icu-utils-num = { path = "../../utils/num" }
fixed-decimal = { path = "../../utils/fixed-decimal" }

[dev-dependencies]
criterion = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion components/pluralrules/benches/operands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod fixtures;
mod helpers;

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use icu_utils_num::FixedDecimal;
use fixed_decimal::FixedDecimal;
use icu_pluralrules::PluralOperands;
use std::convert::TryInto;

Expand Down
4 changes: 2 additions & 2 deletions components/pluralrules/src/operands.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use icu_utils_num::FixedDecimal;
use fixed_decimal::FixedDecimal;
use std::convert::TryFrom;
use std::io::Error as IOError;
use std::isize;
Expand Down Expand Up @@ -201,7 +201,7 @@ impl_integer_type!(u8 u16 u32 u64 u128 usize);
impl_signed_integer_type!(i8 i16 i32 i64 i128 isize);

impl From<&FixedDecimal> for PluralOperands {
/// Converts a [icu_utils_num::FixedDecimal] to [PluralOperands]. Retains at most 18
/// Converts a [fixed_decimal::FixedDecimal] to [PluralOperands]. Retains at most 18
/// digits each from the integer and fraction parts.
fn from(dec: &FixedDecimal) -> Self {
let mag_range = dec.magnitude_range();
Expand Down
2 changes: 1 addition & 1 deletion components/pluralrules/tests/fixtures/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use icu_utils_num::FixedDecimal;
use fixed_decimal::FixedDecimal;
use icu_pluralrules::PluralOperands;
use serde::Deserialize;
use std::convert::TryInto;
Expand Down
2 changes: 1 addition & 1 deletion components/pluralrules/tests/operands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod helpers;

use std::convert::TryInto;

use icu_utils_num::FixedDecimal;
use fixed_decimal::FixedDecimal;
use icu_pluralrules::PluralOperands;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions utils/num/Cargo.toml → utils/fixed-decimal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "icu-utils-num"
description = "Low-level tools for dealing with numbers"
name = "fixed-decimal"
description = "An API for representing numbers in a human-readable form"
version = "0.0.1"
authors = ["The ICU4X Project Developers"]
edition = "2018"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rand_pcg::Lcg64Xsh32;

use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};

use icu_utils_num::FixedDecimal;
use fixed_decimal::FixedDecimal;
use std::str::FromStr;

fn triangular_nums(range: f64) -> Vec<isize> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// (one permyriad) of a monetary unit. FixedDecimal enables a cheap representation of these
// amounts, also while retaining trailing zeros.

use icu_utils_num::FixedDecimal;
use fixed_decimal::FixedDecimal;

fn main() {
let monetary_int = 19_9500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const_assert!(std::mem::size_of::<usize>() >= std::mem::size_of::<u16>());
/// # Examples
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let mut dec = FixedDecimal::from(250);
/// assert_eq!("250", dec.to_string());
Expand Down Expand Up @@ -70,7 +70,7 @@ pub struct FixedDecimal {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let mut dec: FixedDecimal = Default::default();
/// dec.is_negative = true;
Expand Down Expand Up @@ -190,7 +190,7 @@ impl FixedDecimal {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let dec = FixedDecimal::from(945);
/// assert_eq!(0, dec.digit_at(-1));
Expand Down Expand Up @@ -221,7 +221,7 @@ impl FixedDecimal {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let mut dec = FixedDecimal::from(120);
/// assert_eq!(0..=2, dec.magnitude_range());
Expand All @@ -241,7 +241,7 @@ impl FixedDecimal {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let mut dec = FixedDecimal::from(42);
/// assert_eq!("42", dec.to_string());
Expand Down Expand Up @@ -288,7 +288,7 @@ impl FixedDecimal {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let dec = FixedDecimal::from(42).multiplied_pow10(3).expect("Bounds are small");
/// assert_eq!("42000", dec.to_string());
Expand All @@ -305,7 +305,7 @@ impl FixedDecimal {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let dec = FixedDecimal::from(42);
/// let mut result = String::with_capacity(dec.write_len());
Expand All @@ -332,7 +332,7 @@ impl FixedDecimal {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use fixed_decimal::FixedDecimal;
///
/// let dec = FixedDecimal::from(-5000).multiplied_pow10(-2).expect("Bounds are small");
/// let mut result = String::with_capacity(dec.write_len());
Expand Down
12 changes: 6 additions & 6 deletions utils/num/src/lib.rs → utils/fixed-decimal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `icu-num-util` is one of the [`ICU4X`] components.
//! `fixed-decimal` is an utility crate of the [`ICU4X`] project.
//!
//! It includes [`FixedDecimal`], a core API for representing numbers in a human-readable form
//! appropriate for formatting and plural rule selection. It is optimized for operations involving
Expand All @@ -7,7 +7,7 @@
//! # Example
//!
//! ```
//! use icu_utils_num::FixedDecimal;
//! use fixed_decimal::FixedDecimal;
//!
//! let dec = FixedDecimal::from(250)
//! .multiplied_pow10(-2)
Expand Down Expand Up @@ -35,10 +35,10 @@
//! [`FixedDecimal`]: ./struct.FixedDecimal.html
//! [`ICU4X`]: https://github.com/unicode-org/icu4x
pub mod fixed_decimal;
pub mod decimal;
mod uint_iterator;

pub use fixed_decimal::FixedDecimal;
pub use decimal::FixedDecimal;

#[derive(Debug, PartialEq)]
pub enum Error {
Expand All @@ -49,8 +49,8 @@ pub enum Error {
/// # Example
///
/// ```
/// use icu_utils_num::FixedDecimal;
/// use icu_utils_num::Error;
/// use fixed_decimal::FixedDecimal;
/// use fixed_decimal::Error;
///
/// let mut dec1 = FixedDecimal::from(123);
/// assert_eq!(Error::Limit, dec1.multiply_pow10(std::i16::MAX).unwrap_err());
Expand Down
File renamed without changes.

0 comments on commit 49ec298

Please sign in to comment.