Skip to content

Commit

Permalink
Move properties enums/structs to separate crate
Browse files Browse the repository at this point in the history
  • Loading branch information
echeran committed Oct 13, 2021
1 parent 651f113 commit 5b84b60
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 6 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ members = [
"utils/fixed_decimal",
"utils/litemap",
"utils/pattern",
"utils/properties",
"utils/writeable",
"utils/yoke",
"utils/yoke/derive",
Expand Down
1 change: 1 addition & 0 deletions components/uniset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ denylist = ["bench"]
all-features = true

[dependencies]
icu_properties = { version = "0.3", path = "../../utils/properties" }
icu_provider = { version = "0.3", path = "../../provider/core", features = ["macros"] }
litemap = { version = "0.2", path = "../../utils/litemap" }
num_enum = { version = "0.5.4", default-features = false }
Expand Down
2 changes: 0 additions & 2 deletions components/uniset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ extern crate alloc;
#[macro_use]
mod builder;
mod conversions;
pub mod enum_props;
pub mod props;
pub mod provider;
mod ule;
mod uniset;
mod utils;

Expand Down
2 changes: 1 addition & 1 deletion components/uniset/src/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
//! [`TR44`]: https://www.unicode.org/reports/tr44
//! [`TR18`]: https://www.unicode.org/reports/tr18
use crate::enum_props::*;
use crate::provider::*;
use crate::UnicodeSetError;
use icu_properties::*;
use icu_provider::prelude::*;

type UnisetResult<'data> = Result<DataPayload<'data, UnicodePropertyV1Marker>, UnicodeSetError>;
Expand Down
42 changes: 42 additions & 0 deletions utils/properties/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file is part of ICU4X. For terms of use, please see the file
# called LICENSE at the top level of the ICU4X source tree
# (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

[package]
name = "icu_properties"
description = "Definitions for Unicode properties"
version = "0.3.0"
authors = ["The ICU4X Project Developers"]
edition = "2018"
readme = "README.md"
repository = "https://github.com/unicode-org/icu4x"
license-file = "LICENSE"
categories = ["internationalization"]
# Keep this in sync with other crates unless there are exceptions
include = [
"src/**/*",
"examples/**/*",
"benches/**/*",
"tests/**/*",
"Cargo.toml",
"LICENSE",
"README.md"
]

[package.metadata.cargo-all-features]
skip_optional_dependencies = true
# Bench feature gets tested separately and is only relevant for CI
denylist = ["bench"]

[package.metadata.docs.rs]
all-features = true

[dependencies]
num_enum = { version = "0.5.4", default-features = false }
zerovec = { version = "0.3", path = "../../utils/zerovec", features = ["serde"] }

[dev-dependencies]

[lib]
bench = false # This option is required for Benchmark CI
path = "src/lib.rs"
11 changes: 11 additions & 0 deletions utils/properties/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# icu_properties [![crates.io](http://meritbadge.herokuapp.com/icu_properties)](https://crates.io/crates/icu_properties)

`icu_properties` is a utility crate of the [`ICU4X`] project.

This component provides definitions of [Unicode Properties].

[Unicode Properties]: https://unicode-org.github.io/icu/userguide/strings/properties.html

## More Information

For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x).
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub enum GeneralSubcategory {
/// See UCharCategory and U_GET_GC_MASK in ICU4C.
#[derive(Copy, Clone, PartialEq, Debug, Eq)]
#[repr(transparent)]
pub struct GeneralCategory(pub(crate) u32);
pub struct GeneralCategory(pub u32);

use GeneralCategory as GC;
use GeneralSubcategory as GS;
Expand Down Expand Up @@ -235,7 +235,7 @@ impl From<GeneralSubcategory> for GeneralCategory {
/// See UScriptCode in ICU4C.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(transparent)]
pub struct Script(pub(crate) u16);
pub struct Script(pub u16);

#[allow(missing_docs)] // These constants don't need individual documentation.
#[allow(non_upper_case_globals)]
Expand Down
14 changes: 14 additions & 0 deletions utils/properties/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

//! `icu_properties` is a utility crate of the [`ICU4X`] project.
//!
//! This component provides definitions of [Unicode Properties].
//!
//! [Unicode Properties]: https://unicode-org.github.io/icu/userguide/strings/properties.html
mod enum_props;
mod ule;

pub use enum_props::*;
3 changes: 2 additions & 1 deletion components/uniset/src/ule.rs → utils/properties/src/ule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

use crate::enum_props::{GeneralSubcategory, Script};
use crate::{GeneralSubcategory, Script};

use core::convert::TryFrom;
use num_enum::TryFromPrimitiveError;
use zerovec::ule::{AsULE, PlainOldULE, ULE};
Expand Down

0 comments on commit 5b84b60

Please sign in to comment.