Skip to content

Commit 3117d88

Browse files
committed
bake
1 parent 10fedab commit 3117d88

File tree

6 files changed

+84
-220
lines changed

6 files changed

+84
-220
lines changed

Cargo.lock

Lines changed: 8 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unicode_data/Cargo.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ publish = false
1010

1111
[features]
1212
default = ["baked"]
13-
baked = []
14-
datagen = ["dep:databake", "icu_provider/export", "icu_collections/databake"]
13+
baked = ["dep:zerovec"]
14+
datagen = []
1515

1616
[dependencies]
17-
icu_locale = { workspace = true }
1817
icu_properties = { workspace = true }
19-
icu_collections = { workspace = true, features = ["serde"] }
20-
icu_provider = { workspace = true, features = ["alloc"] }
21-
yoke = { workspace = true, features = ["derive"] }
22-
zerofrom = { workspace = true }
23-
unicode-bidi = { workspace = true, features = ["smallvec"] }
24-
serde = { workspace = true }
25-
databake = { workspace = true, features = ["derive"], optional = true }
18+
icu_collections = { workspace = true }
19+
unicode-bidi = { workspace = true }
20+
zerovec = { workspace = true, optional = true }
2621

2722
[lints]
2823
workspace = true

unicode_data/src/generated/composite/mod.rs

Lines changed: 26 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unicode_data/src/lib.rs

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,67 +8,27 @@
88
99
#![no_std]
1010

11-
use icu_collections::codepointtrie::CodePointTrie;
1211
use icu_properties::props::{GeneralCategory, GraphemeClusterBreak, Script};
13-
use zerofrom::ZeroFrom;
1412

15-
/// Baked data for the `CompositePropsV1` data provider.
13+
/// Baked data.
1614
#[cfg(feature = "baked")]
1715
pub mod generated;
1816

19-
/// A data provider of `CompositePropsV1`.
20-
#[derive(Clone, Debug, Eq, PartialEq, yoke::Yokeable, ZeroFrom)]
21-
#[cfg_attr(feature = "datagen", derive(databake::Bake))]
22-
#[cfg_attr(feature = "datagen", databake(path = composite_props_marker))]
23-
pub struct CompositePropsV1Data<'data> {
24-
trie: CodePointTrie<'data, u32>,
25-
}
26-
27-
#[cfg(feature = "datagen")]
28-
icu_provider::data_struct!(CompositePropsV1Data<'_>);
29-
30-
impl serde::Serialize for CompositePropsV1Data<'_> {
31-
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
32-
where
33-
S: serde::Serializer,
34-
{
35-
serializer.serialize_newtype_struct("CompositePropsV1Data", &self.trie)
36-
}
37-
}
17+
/// Lookup for [`Properties`]
18+
#[derive(Clone, Debug, Copy)]
19+
pub struct CompositeProps;
3820

39-
impl<'de> serde::Deserialize<'de> for CompositePropsV1Data<'de> {
40-
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41-
where
42-
D: serde::Deserializer<'de>,
43-
{
44-
let trie = CodePointTrie::deserialize(deserializer)?;
45-
Ok(CompositePropsV1Data { trie })
46-
}
47-
}
48-
49-
impl<'data> CompositePropsV1Data<'data> {
50-
/// Creates a new `CompositePropsV1Data` from a `CodePointTrie`.
51-
pub fn new(trie: CodePointTrie<'data, u32>) -> Self {
52-
Self { trie }
53-
}
54-
}
55-
56-
icu_provider::data_marker!(
57-
/// Marker for the composite multi-property trie (locale-invariant singleton)
58-
CompositePropsV1,
59-
CompositePropsV1Data<'static>,
60-
is_singleton = true,
61-
);
62-
63-
impl CompositePropsV1Data<'_> {
21+
#[cfg(feature = "baked")]
22+
impl CompositeProps {
6423
/// Returns the properties for a given character.
6524
#[inline(always)]
6625
pub fn properties(&self, ch: u32) -> Properties {
67-
Properties(self.trie.get32(ch))
26+
Properties(generated::COMPOSITE.get32(ch))
6827
}
6928
}
7029

71-
impl unicode_bidi::BidiDataSource for CompositePropsV1Data<'_> {
30+
#[cfg(feature = "baked")]
31+
impl unicode_bidi::BidiDataSource for CompositeProps {
7232
fn bidi_class(&self, cp: char) -> unicode_bidi::BidiClass {
7333
self.properties(cp as u32).bidi_class()
7434
}

unicode_data_gen/Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@ publish = false
1010

1111
[dependencies]
1212
icu_locale = { workspace = true }
13-
icu_properties = { workspace = true, features = ["datagen"] }
13+
icu_properties = { workspace = true, features = ["compiled_data"] }
1414
icu_collections = { workspace = true, features = ["databake", "serde"] }
1515
icu_provider = { workspace = true, features = ["baked"] }
1616
icu_provider_source = { workspace = true, features = ["networking", "use_wasm"] }
1717
yoke = { workspace = true, features = ["derive"] }
1818
zerofrom = { workspace = true }
19-
unicode-bidi = { workspace = true, features = ["smallvec"] }
2019
unicode_data = { workspace = true, default-features = false, features = ["datagen"] }
21-
icu_normalizer = { workspace = true }
20+
icu_normalizer = { workspace = true, features = ["compiled_data"] }
2221
icu_segmenter = { workspace = true }
23-
icu_provider_export = { workspace = true, features = ["baked_exporter", "blob_exporter"] }
22+
icu_provider_export = { workspace = true, features = ["baked_exporter"] }
2423
serde = { workspace = true, features = ["derive"] }
2524
databake = { workspace = true, features = ["derive"] }
2625
icu_codepointtrie_builder = { workspace = true, features = ["wasm"] }
27-
icu_provider_adapters = { workspace = true, features = ["export"] }
2826

2927
[lints]
3028
workspace = true

0 commit comments

Comments
 (0)