Skip to content

Commit 7fa14e3

Browse files
committed
Move unic-ucd-utils to unic-utils-codepoints
Create `unic-utils` component and put the Code Point-related utilities under a new component named `unic-utils-codepoints`.
1 parent 9873ffe commit 7fa14e3

File tree

13 files changed

+111
-28
lines changed

13 files changed

+111
-28
lines changed

unic/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ bench_it = ["unic-bidi/bench_it"]
2020
serde = ["unic-bidi/serde"]
2121

2222
[dependencies]
23-
unic-ucd = { path = "ucd/", version = "0.4.0" }
2423
unic-bidi = { path = "bidi/", version = "0.4.0" }
2524
unic-idna = { path = "idna/", version = "0.4.0" }
2625
unic-normal = { path = "normal/", version = "0.4.0" }
26+
unic-ucd = { path = "ucd/", version = "0.4.0" }
27+
unic-utils = { path = "utils/", version = "0.4.0" }
2728

2829
[badges]
2930
travis-ci = { repository = "behnam/rust-unic", branch = "master" }

unic/ucd/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ unic-ucd-age = { path = "age/", version = "0.4.0" }
2020
unic-ucd-bidi = { path = "bidi/", version = "0.4.0" }
2121
unic-ucd-core = { path = "core/", version = "0.4.0" }
2222
unic-ucd-normal = { path = "normal/", version = "0.4.0" }
23-
unic-ucd-utils = { path = "utils/", version = "0.4.0" }
2423
unic-ucd-category = { path = "category/", version = "0.4.0" }
24+
25+
[dev-dependencies]
26+
unic-utils = { path = "../utils/", version = "0.4.0" }

unic/ucd/age/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ travis-ci = { repository = "behnam/rust-unic", branch = "master" }
1818
unic-ucd-core = { path = "../core/", version = "0.4.0" }
1919

2020
[dev-dependencies]
21-
unic-ucd-utils = { path = "../utils/", version = "0.4.0" }
21+
unic-utils-codepoints = { path = "../../utils/codepoints", version = "0.4.0" }

unic/ucd/age/tests/age_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
extern crate unic_ucd_age;
1313
extern crate unic_ucd_core;
14-
extern crate unic_ucd_utils;
14+
extern crate unic_utils_codepoints;
1515

1616
use unic_ucd_age::{Age, UnicodeVersion, UNICODE_VERSION};
17-
use unic_ucd_utils::iter_all_chars;
17+
use unic_utils_codepoints::iter_all_chars;
1818

1919
/// Character *assignement* values always have Unicode Micro (Update) Version value of zero (`0`).
2020
#[test]

unic/ucd/normal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ travis-ci = { repository = "behnam/rust-unic", branch = "master" }
1818
unic-ucd-core = { path = "../core/", version = "0.4.0" }
1919

2020
[dev-dependencies]
21-
unic-ucd-utils = { path = "../utils/", version = "0.4.0" }
21+
unic-utils-codepoints = { path = "../../utils/codepoints", version = "0.4.0" }

unic/ucd/normal/tests/conformance_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111

1212
extern crate unic_ucd_normal;
13-
extern crate unic_ucd_utils;
13+
extern crate unic_utils_codepoints;
1414

1515
use unic_ucd_normal::DecompositionType as DT;
16-
use unic_ucd_utils::iter_all_chars;
16+
use unic_utils_codepoints::iter_all_chars;
1717
use std::collections::HashSet as Set;
1818
use std::{char, u32};
1919

unic/ucd/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub extern crate unic_ucd_age as age;
2424
pub extern crate unic_ucd_bidi as bidi;
2525
pub extern crate unic_ucd_normal as normal;
2626
pub extern crate unic_ucd_category as category;
27-
pub extern crate unic_ucd_utils as utils;
2827

2928

3029
/// The [Unicode version](http://www.unicode.org/versions/) of data

unic/ucd/tests/category_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313

1414

1515
extern crate unic_ucd;
16+
extern crate unic_utils;
1617

1718

1819
use unic_ucd::bidi::BidiClass;
1920
use unic_ucd::normal::is_combining_mark;
20-
use unic_ucd::utils::iter_all_chars;
21+
use unic_utils::iter_all_chars;
2122

2223

2324
/// `Bidi_Class=NSM := General_Category in { Mn (Nonspacing_Mark), Me (Enclosing_Mark) }`

unic/utils/Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "unic-utils"
3+
version = "0.4.0"
4+
authors = ["The UNIC Project Developers"]
5+
homepage = "https://github.com/behnam/rust-unic/"
6+
repository = "https://github.com/behnam/rust-unic/"
7+
license = "MIT/Apache-2.0"
8+
keywords = ["text", "unicode"]
9+
description = "UNIC - Utilities"
10+
11+
# No tests/benches that depends on /data/
12+
exclude = []
13+
14+
[badges]
15+
travis-ci = { repository = "behnam/rust-unic", branch = "master" }
16+
17+
[dependencies]
18+
unic-utils-codepoints = { path = "codepoints/", version = "0.4.0" }

unic/ucd/utils/Cargo.toml renamed to unic/utils/codepoints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "unic-ucd-utils"
2+
name = "unic-utils-codepoints"
33
version = "0.4.0"
44
authors = ["The UNIC Project Developers"]
55
homepage = "https://github.com/behnam/rust-unic/"

unic/ucd/utils/src/lib.rs renamed to unic/utils/codepoints/src/codepoints.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,29 @@
99
// except according to those terms.
1010

1111

12-
#![forbid(unsafe_code, missing_docs)]
13-
14-
//! # UNIC — UCD — Utils
15-
//!
16-
//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
17-
//!
18-
//! Utilities for working with Unicode Code Points
19-
//!
20-
//! ## Definitions
21-
//!
22-
//! * [**Unicode Code Point**](http://unicode.org/glossary/#code_point)
23-
//! * [**Unicode Scalar Value**](http://unicode.org/glossary/#unicode_scalar_value)
24-
25-
2612
use std::char::from_u32;
2713
use std::ops::Range;
2814

2915

30-
/// Range of valid Unicode Code Points.
16+
/// Range of Unicode Code Points.
17+
///
18+
/// Reference: <http://unicode.org/glossary/#code_point>
3119
pub const CODEPOINTS_RANGE: Range<u32> = 0x0..(0x10FFFF + 1);
3220

33-
/// Range of Surroate Code Points, which are not Unicde Scalar Values.
21+
/// Range of Unicde Scalar Values.
22+
///
23+
/// Reference: <http://unicode.org/glossary/#unicode_scalar_value>
3424
const SCALAR_VALUE_RANGE_1: Range<u32> = 0x0..0xD800;
3525
const SCALAR_VALUE_RANGE_2: Range<u32> = (0xDFFF + 1)..(0x10_FFFF + 1);
3626

3727
/// Check a code-point against `SURROGATE_CODEPOINTS_RANGE`.
3828
#[inline]
3929
pub fn iter_all_chars() -> Box<Iterator<Item = char>> {
4030
Box::new(
41-
// TODO: use char::from_u32_unchecked()
31+
// TODO: maybe use char::from_u32_unchecked()
4232
SCALAR_VALUE_RANGE_1
4333
.chain(SCALAR_VALUE_RANGE_2)
4434
.filter_map(from_u32),
4535
)
4636
}
37+

unic/utils/codepoints/src/lib.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2017 The UNIC Project Developers.
2+
//
3+
// See the COPYRIGHT file at the top-level directory of this distribution.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
12+
#![forbid(unsafe_code, missing_docs)]
13+
14+
//! # UNIC — Utils — Code Points
15+
//!
16+
//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
17+
//!
18+
//! Utilities for working with Unicode Code Points
19+
//!
20+
//! ## Definitions
21+
//!
22+
//! * [**Unicode Code Point**](http://unicode.org/glossary/#code_point)
23+
//! * [**Unicode Scalar Value**](http://unicode.org/glossary/#unicode_scalar_value)
24+
25+
26+
/// UNIC component version.
27+
pub const PKG_VERSION: &'static str = env!("CARGO_PKG_VERSION");
28+
29+
/// UNIC component name.
30+
pub const PKG_NAME: &'static str = env!("CARGO_PKG_NAME");
31+
32+
/// UNIC component description.
33+
pub const PKG_DESCRIPTION: &'static str = env!("CARGO_PKG_DESCRIPTION");
34+
35+
36+
mod codepoints;
37+
38+
39+
pub use codepoints::{iter_all_chars, CODEPOINTS_RANGE};

unic/utils/src/lib.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2017 The UNIC Project Developers.
2+
//
3+
// See the COPYRIGHT file at the top-level directory of this distribution.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
12+
#![forbid(unsafe_code, missing_docs)]
13+
14+
//! # UNIC — Utilities
15+
//!
16+
//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
17+
18+
19+
/// UNIC component version.
20+
pub const PKG_VERSION: &'static str = env!("CARGO_PKG_VERSION");
21+
22+
/// UNIC component name.
23+
pub const PKG_NAME: &'static str = env!("CARGO_PKG_NAME");
24+
25+
/// UNIC component description.
26+
pub const PKG_DESCRIPTION: &'static str = env!("CARGO_PKG_DESCRIPTION");
27+
28+
29+
pub extern crate unic_utils_codepoints as codepoints;
30+
31+
32+
pub use codepoints::iter_all_chars;

0 commit comments

Comments
 (0)