Skip to content

Commit

Permalink
Merge branch 'main' into bake
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Dec 21, 2022
2 parents 37f2334 + 22866d3 commit af3d99a
Show file tree
Hide file tree
Showing 57 changed files with 109 additions and 175 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions experimental/displaynames/src/displaynames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! This module contains types and implementations for the Displaynames component.

use crate::options::*;
use crate::provider::TerritoryDisplayNamesV1Marker;
use crate::provider::RegionDisplayNamesV1Marker;
use icu_provider::prelude::*;
use icu_provider::{DataError, DataPayload};
use tinystr::TinyAsciiStr;
Expand Down Expand Up @@ -34,7 +34,7 @@ use tinystr::TinyStrError;
/// ```
pub struct DisplayNames {
options: DisplayNamesOptions,
data: DataPayload<TerritoryDisplayNamesV1Marker>,
data: DataPayload<RegionDisplayNamesV1Marker>,
}

impl DisplayNames {
Expand All @@ -44,7 +44,7 @@ impl DisplayNames {
/// <div class="stab unstable">
/// ⚠️ The bounds on this function may change over time, including in SemVer minor releases.
/// </div>
pub fn try_new_region_unstable<D: DataProvider<TerritoryDisplayNamesV1Marker> + ?Sized>(
pub fn try_new_region_unstable<D: DataProvider<RegionDisplayNamesV1Marker> + ?Sized>(
data_provider: &D,
locale: &DataLocale,
options: DisplayNamesOptions,
Expand Down
6 changes: 3 additions & 3 deletions experimental/displaynames/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use zerovec::ZeroMap;
// become inaccessible).
type UnvalidatedRegion = TinyAsciiStr<3>;

#[icu_provider::data_struct(TerritoryDisplayNamesV1Marker = "displaynames/territories@1")]
#[icu_provider::data_struct(RegionDisplayNamesV1Marker = "displaynames/regions@1")]
#[derive(Debug, PartialEq, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[cfg_attr(
Expand All @@ -29,8 +29,8 @@ type UnvalidatedRegion = TinyAsciiStr<3>;
databake(path = icu_displaynames::provider),
)]
#[yoke(prove_covariance_manually)]
/// TerritoryDisplayNames provides mapping between a region code and locale display name.
pub struct TerritoryDisplayNamesV1<'data> {
/// RegionDisplayNames provides mapping between a region code and locale display name.
pub struct RegionDisplayNamesV1<'data> {
/// Mapping for region to locale display name.
#[cfg_attr(feature = "serde", serde(borrow))]
pub names: ZeroMap<'data, UnvalidatedRegion, str>,
Expand Down
8 changes: 4 additions & 4 deletions experimental/segmenter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ skip_optional_dependencies = true
icu_collections = { version = "1.0.0", path = "../../components/collections" }
icu_provider = { version = "1.0.0", path = "../../provider/core", features = ["macros"] }
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
zerovec = { version = "0.9", path = "../../utils/zerovec", features = ["yoke"] }
databake = { version = "0.1.0", path = "../../utils/databake", optional = true, features = ["derive"] }
ndarray = { version = "0.15.5", default-features = false, optional = true, features = ["serde"] }
ndarray = { version = "0.15.5", default-features = false, optional = true }
num-traits = { version = "0.2", default-features = false, optional = true, features = ["libm"] }
icu_locid = { version = "1.0.0", path = "../../components/locid" }
utf8_iter = "1.0.3"
Expand All @@ -43,7 +42,8 @@ displaydoc = { version = "0.2.3", default-features = false }
[dev-dependencies]
criterion = "0.3"
icu_testdata = { path = "../../provider/testdata", default-features = false, features = ["buffer", "icu_segmenter"] }
serde-json-core = { version = "0.4", features = ["std"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = "1.0"
icu = { path = "../../components/icu", features = ["experimental"]}

[lib]
Expand All @@ -61,6 +61,6 @@ required-features = ["lstm"]
[features]
default = []
std = []
lstm = ["ndarray", "num-traits", "serde"]
lstm = ["ndarray", "num-traits"]
serde = ["dep:serde", "zerovec/serde", "icu_collections/serde", "icu_provider/serde"]
datagen = ["serde", "databake", "zerovec/databake", "icu_collections/databake"]
6 changes: 3 additions & 3 deletions experimental/segmenter/src/lstm_bies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,22 +238,22 @@ mod tests {
use super::*;
use crate::provider::GraphemeClusterBreakDataV1Marker;
use icu_provider::prelude::*;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use std::fs::File;
use std::io::BufReader;

/// `TestCase` is a struct used to store a single test case.
/// Each test case has two attributs: `unseg` which denots the unsegmented line, and `true_bies` which indicates the Bies
/// sequence representing the true segmentation.
#[derive(PartialEq, Debug, Serialize, Deserialize)]
#[derive(PartialEq, Debug, Deserialize)]
pub struct TestCase {
pub unseg: String,
pub expected_bies: String,
pub true_bies: String,
}

/// `TestTextData` is a struct to store a vector of `TestCase` that represents a test text.
#[derive(PartialEq, Debug, Serialize, Deserialize)]
#[derive(PartialEq, Debug, Deserialize)]
pub struct TestTextData {
pub testcases: Vec<TestCase>,
}
Expand Down
4 changes: 2 additions & 2 deletions ffi/diplomat/ffi_coverage/tests/missing_apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ icu::displaynames::options::LanguageDisplay#Enum
icu::displaynames::options::Style#Enum
icu::displaynames::provider::LanguageDisplayNamesV1#Struct
icu::displaynames::provider::LanguageDisplayNamesV1Marker#Struct
icu::displaynames::provider::TerritoryDisplayNamesV1#Struct
icu::displaynames::provider::TerritoryDisplayNamesV1Marker#Struct
icu::displaynames::provider::RegionDisplayNamesV1#Struct
icu::displaynames::provider::RegionDisplayNamesV1Marker#Struct
icu::properties::exemplar_chars::load_exemplars_auxiliary#Fn
icu::properties::exemplar_chars::load_exemplars_index#Fn
icu::properties::exemplar_chars::load_exemplars_main#Fn
Expand Down
12 changes: 6 additions & 6 deletions ffi/diplomat/js/examples/node/package-lock.json

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

18 changes: 0 additions & 18 deletions ffi/gn/Cargo.lock

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

4 changes: 0 additions & 4 deletions ffi/gn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,5 @@ rustflags = ["--cfg=ops_bound", "--cfg=core_reverse", "--cfg=de_boxed_c_str", "-
[gn.package.serde_derive."1.0.130"]
rustflags = ["--cfg=underscore_consts", "--cfg=ptr_addr_of"]

# TODO: Determine the correct rustflags for serde_json
[gn.package.serde_json."1.0.69"]
rustflags = []

[gn.package.syn."1.0.81"]
rustflags = []
43 changes: 0 additions & 43 deletions ffi/gn/icu4x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,6 @@ rust_library("icu_segmenter-v0_7_0") {
deps += [ ":icu_collections-v1_0_0" ]
deps += [ ":icu_locid-v1_0_0" ]
deps += [ ":icu_provider-v1_0_1" ]
deps += [ ":serde_json-v1_0_69" ]
deps += [ ":utf8_iter-v1_0_3" ]
deps += [ ":zerovec-v0_9_1" ]

Expand Down Expand Up @@ -669,25 +668,6 @@ rust_library("icu_timezone-v1_0_0") {
visibility = [ ":*" ]
}

rust_library("itoa-v0_4_8") {
crate_name = "itoa"
crate_root = "//ffi/gn/vendor/itoa/src/lib.rs"
output_name = "itoa-9e27afdde10ba0b5"

deps = []

rustenv = []

rustflags = [
"--cap-lints=allow",
"--edition=2015",
"-Cmetadata=9e27afdde10ba0b5",
"-Cextra-filename=-9e27afdde10ba0b5",
]

visibility = [ ":*" ]
}

rust_library("lazy_static-v1_4_0") {
crate_name = "lazy_static"
crate_root = "//ffi/gn/vendor/lazy_static/src/lib.rs"
Expand Down Expand Up @@ -928,29 +908,6 @@ rust_proc_macro("serde_derive-v1_0_130") {
visibility = [ ":*" ]
}

rust_library("serde_json-v1_0_69") {
crate_name = "serde_json"
crate_root = "//ffi/gn/vendor/serde_json/src/lib.rs"
output_name = "serde_json-3a9f5b638834f68f"

deps = []
deps += [ ":itoa-v0_4_8" ]
deps += [ ":ryu-v1_0_5" ]
deps += [ ":serde-v1_0_130" ]

rustenv = []

rustflags = [
"--cap-lints=allow",
"--edition=2018",
"-Cmetadata=3a9f5b638834f68f",
"-Cextra-filename=-3a9f5b638834f68f",
"--cfg=feature=\"alloc\"",
]

visibility = [ ":*" ]
}

rust_library("smallvec-v1_10_0") {
crate_name = "smallvec"
crate_root = "//ffi/gn/vendor/smallvec/src/lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion provider/datagen/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ registry!(
{
CaseMappingV1Marker,
DateSkeletonPatternsV1Marker,
TerritoryDisplayNamesV1Marker,
RegionDisplayNamesV1Marker,
LanguageDisplayNamesV1Marker,
GraphemeClusterBreakDataV1Marker,
LineBreakDataV1Marker,
Expand Down
2 changes: 1 addition & 1 deletion provider/datagen/src/transform/cldr/cldr_serde/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ pub mod numbering_systems;
pub mod numbers;
pub mod parent_locales;
pub mod plurals;
pub mod territory_displaynames;
pub mod region_displaynames;
pub mod time_zones;
pub mod week_data;
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ use serde::Deserialize;
use std::collections::HashMap;

#[derive(PartialEq, Debug, Deserialize)]
pub struct Territories {
pub territories: HashMap<String, String>,
pub struct Regions {
#[serde(rename = "territories")]
pub regions: HashMap<String, String>,
}

#[derive(PartialEq, Debug, Deserialize)]
pub struct LangDisplayNames {
#[serde(rename = "localeDisplayNames")]
pub localedisplaynames: Territories,
pub localedisplaynames: Regions,
}

#[derive(PartialEq, Debug, Deserialize)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl IterableDataProvider<LanguageDisplayNamesV1Marker> for crate::DatagenProvid
}
}

/// Substring used to denote alternative region names data variants for a given territory. For example: "BA-alt-short", "TL-alt-variant".
/// Substring used to denote alternative region names data variants for a given region. For example: "BA-alt-short", "TL-alt-variant".
const ALT_SUBSTRING: &str = "-alt-";

impl From<&cldr_serde::language_displaynames::Resource> for LanguageDisplayNamesV1<'static> {
Expand Down
2 changes: 1 addition & 1 deletion provider/datagen/src/transform/cldr/displaynames/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

pub mod language;
pub mod territory;
pub mod region;
Loading

0 comments on commit af3d99a

Please sign in to comment.