Skip to content

Commit e6d9c2e

Browse files
DataProvider constructor for JS/Dart (#6596)
Turns out we already have support for passing owned byte buffers in Diplomat.
1 parent 83117dd commit e6d9c2e

File tree

10 files changed

+204
-9
lines changed

10 files changed

+204
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ Several crates have had patch releases in the 2.0 stream:
99
- `icu_properties`, `icu_properties_data`
1010
- Fix a visibility bug in compiled data (unicode-org#6580)
1111
- `icu_provider_baked`
12-
- Fix an issue where a single-locale data generation would skip fallback (unicode-org#6582)
12+
- Fix an issue where a single-locale data generation would skip fallback (unicode-org#6582)
13+
- `icu_capi`
14+
- Rename string-methods on `DecomposingNormalizer` to match those on `ComposingNormalizer` (unicode-org#6594)
15+
- Add `DataProvider` constructors in JS and Dart (unicode-org#6596)
1316

1417
## icu4x 2.0
1518

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bn.blob

1.42 KB
Binary file not shown.

ffi/capi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ include = [
1515
"LICENSE",
1616
"README.md"
1717
]
18+
version = "2.0.1"
1819

1920
authors.workspace = true
2021
categories.workspace = true
2122
edition.workspace = true
2223
homepage.workspace = true
2324
repository.workspace = true
2425
rust-version.workspace = true
25-
version.workspace = true
2626

2727
[package.metadata.docs.rs]
2828
all-features = true
@@ -145,7 +145,7 @@ icu_time = { workspace = true, features = ["alloc", "ixdtf"], optional = true }
145145
icu_experimental = { workspace = true, optional = true }
146146

147147
# Optional ICU4X features (not components)
148-
icu_provider_blob = { workspace = true, optional = true }
148+
icu_provider_blob = { workspace = true, features = ["alloc"], optional = true }
149149
serde = { workspace = true, optional = true }
150150
unicode-bidi = { workspace = true, optional = true }
151151
log = { workspace = true, optional = true }

ffi/capi/bindings/cpp/icu4x/DataProvider.d.hpp

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffi/capi/bindings/dart/DataProvider.g.dart

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

ffi/capi/bindings/js/DataProvider.d.ts

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

ffi/capi/bindings/js/DataProvider.mjs

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

ffi/capi/src/provider.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#[cfg(feature = "buffer_provider")]
99
pub mod ffi {
1010
use alloc::boxed::Box;
11+
use diplomat_runtime::DiplomatByte;
1112
use icu_provider::buf::BufferProvider;
1213

1314
use crate::unstable::errors::ffi::DataError;
@@ -73,7 +74,10 @@ pub mod ffi {
7374
}
7475

7576
/// Constructs a `BlobDataProvider` and returns it as an [`DataProvider`].
76-
#[diplomat::rust_link(icu_provider_blob::BlobDataProvider, Struct)]
77+
#[diplomat::rust_link(
78+
icu_provider_blob::BlobDataProvider::try_new_from_static_blob,
79+
FnInStruct
80+
)]
7781
#[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor)]
7882
#[diplomat::attr(not(supports = static_slices), disable)]
7983
pub fn from_byte_slice(
@@ -84,6 +88,18 @@ pub mod ffi {
8488
)))))
8589
}
8690

91+
#[diplomat::rust_link(icu_provider_blob::BlobDataProvider::try_new_from_blob, FnInStruct)]
92+
#[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor)]
93+
#[diplomat::attr(supports = static_slices, disable)]
94+
#[diplomat::attr(*, rename = "from_byte_slice")]
95+
pub fn from_owned_byte_slice(
96+
blob: Box<[DiplomatByte]>,
97+
) -> Result<Box<DataProvider>, DataError> {
98+
Ok(Box::new(DataProvider(Some(Box::new(
99+
icu_provider_blob::BlobDataProvider::try_new_from_blob(blob)?,
100+
)))))
101+
}
102+
87103
/// Creates a provider that tries the current provider and then, if the current provider
88104
/// doesn't support the data key, another provider `other`.
89105
///

ffi/npm/test/data-providers.mjs

Lines changed: 131 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,140 @@
44

55
import test from 'ava';
66

7-
import { Decimal, Locale, DecimalFormatter, DecimalGroupingStrategy } from 'icu4x';
7+
import { Decimal, Locale, DecimalFormatter, DecimalGroupingStrategy, DataProvider } from 'icu4x';
8+
9+
test('use createFromBlob to format a simple decimal', async t => {
10+
// icu4x-datagen --markers DecimalSymbolsV1 DecimalDigitsV1 --locales bn --format blob --out bn.blob && xxd -i bn.blob
11+
const bnBlob = [
12+
0x03, 0x08, 0x31, 0x43, 0x45, 0x84, 0x99, 0x47, 0xd1, 0xf9, 0xd3, 0x01,
13+
0x02, 0x00, 0x20, 0x00, 0xc2, 0x62, 0x75, 0x18, 0x6e, 0x90, 0x0b, 0xc2,
14+
0x1e, 0x2d, 0x06, 0x6c, 0x61, 0x74, 0x6e, 0x90, 0x0c, 0x49, 0x4e, 0x90,
15+
0x0b, 0x1e, 0x6c, 0x61, 0x74, 0x6e, 0x90, 0x0c, 0x6e, 0x64, 0x90, 0x0d,
16+
0x75, 0x6e, 0x64, 0x1e, 0xce, 0x61, 0x62, 0x63, 0x64, 0x67, 0x68, 0x6a,
17+
0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x74, 0x76, 0x0f, 0x13, 0x18, 0x1c, 0x25,
18+
0x34, 0x39, 0x44, 0x4d, 0x64, 0x68, 0x73, 0x8a, 0xc2, 0x64, 0x72, 0x04,
19+
0x6c, 0x6d, 0x90, 0x0a, 0x61, 0x62, 0x81, 0x65, 0x78, 0x74, 0x82, 0x65,
20+
0x6e, 0x67, 0x85, 0x61, 0x6b, 0x6d, 0x90, 0x08, 0x65, 0x76, 0x61, 0x84,
21+
0x75, 0xc2, 0x6a, 0x72, 0x02, 0x72, 0x87, 0x75, 0x86, 0xc2, 0x61, 0x6d,
22+
0x07, 0x6e, 0x69, 0x64, 0x65, 0x63, 0x90, 0x04, 0x6e, 0x70, 0x90, 0x09,
23+
0x61, 0x76, 0x61, 0x90, 0x06, 0xc2, 0x68, 0x6e, 0x04, 0x6d, 0x72, 0x90,
24+
0x01, 0x64, 0x61, 0x8b, 0x61, 0xc2, 0x6f, 0x74, 0x02, 0x6f, 0x8e, 0x6e,
25+
0x80, 0xc4, 0x6c, 0x6f, 0x74, 0x79, 0x03, 0x07, 0x0b, 0x79, 0x6d, 0x8c,
26+
0x6e, 0x67, 0x90, 0x02, 0x65, 0x69, 0x90, 0x07, 0x6d, 0x72, 0x90, 0x00,
27+
0x6b, 0x6f, 0x6f, 0x83, 0xc2, 0x6c, 0x72, 0x04, 0x63, 0x6b, 0x90, 0x03,
28+
0x79, 0x61, 0x88, 0xc4, 0x61, 0x65, 0x68, 0x69, 0x06, 0x09, 0x0c, 0x6d,
29+
0x6c, 0x64, 0x65, 0x63, 0x89, 0x6c, 0x75, 0x8a, 0x61, 0x69, 0x8d, 0x62,
30+
0x74, 0x8f, 0x61, 0x69, 0x69, 0x90, 0x05, 0xd2, 0x09, 0x1e, 0x00, 0x00,
31+
0x00, 0x14, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00,
32+
0x00, 0x6e, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00,
33+
0x00, 0xe6, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x36, 0x01, 0x00,
34+
0x00, 0x5e, 0x01, 0x00, 0x00, 0x86, 0x01, 0x00, 0x00, 0xae, 0x01, 0x00,
35+
0x00, 0xd6, 0x01, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x26, 0x02, 0x00,
36+
0x00, 0x4e, 0x02, 0x00, 0x00, 0x76, 0x02, 0x00, 0x00, 0x9e, 0x02, 0x00,
37+
0x00, 0xc6, 0x02, 0x00, 0x00, 0xee, 0x02, 0x00, 0x00, 0x16, 0x03, 0x00,
38+
0x00, 0x3e, 0x03, 0x00, 0x00, 0x66, 0x03, 0x00, 0x00, 0x8e, 0x03, 0x00,
39+
0x00, 0xc0, 0x03, 0x00, 0x00, 0xf2, 0x03, 0x00, 0x00, 0x24, 0x04, 0x00,
40+
0x00, 0x36, 0x04, 0x00, 0x00, 0x48, 0x04, 0x00, 0x00, 0x01, 0x30, 0x01,
41+
0x31, 0x01, 0x32, 0x01, 0x33, 0x01, 0x34, 0x01, 0x35, 0x01, 0x36, 0x01,
42+
0x37, 0x01, 0x38, 0x01, 0x39, 0x02, 0xd9, 0xa0, 0x02, 0xd9, 0xa1, 0x02,
43+
0xd9, 0xa2, 0x02, 0xd9, 0xa3, 0x02, 0xd9, 0xa4, 0x02, 0xd9, 0xa5, 0x02,
44+
0xd9, 0xa6, 0x02, 0xd9, 0xa7, 0x02, 0xd9, 0xa8, 0x02, 0xd9, 0xa9, 0x02,
45+
0xdb, 0xb0, 0x02, 0xdb, 0xb1, 0x02, 0xdb, 0xb2, 0x02, 0xdb, 0xb3, 0x02,
46+
0xdb, 0xb4, 0x02, 0xdb, 0xb5, 0x02, 0xdb, 0xb6, 0x02, 0xdb, 0xb7, 0x02,
47+
0xdb, 0xb8, 0x02, 0xdb, 0xb9, 0x02, 0xdf, 0x80, 0x02, 0xdf, 0x81, 0x02,
48+
0xdf, 0x82, 0x02, 0xdf, 0x83, 0x02, 0xdf, 0x84, 0x02, 0xdf, 0x85, 0x02,
49+
0xdf, 0x86, 0x02, 0xdf, 0x87, 0x02, 0xdf, 0x88, 0x02, 0xdf, 0x89, 0x03,
50+
0xe0, 0xa5, 0xa6, 0x03, 0xe0, 0xa5, 0xa7, 0x03, 0xe0, 0xa5, 0xa8, 0x03,
51+
0xe0, 0xa5, 0xa9, 0x03, 0xe0, 0xa5, 0xaa, 0x03, 0xe0, 0xa5, 0xab, 0x03,
52+
0xe0, 0xa5, 0xac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a8, 0x03, 0xe1, 0x9f, 0xa9, 0x03, 0xe1, 0xa0, 0x90, 0x03,
97+
0xe1, 0xa0, 0x91, 0x03, 0xe1, 0xa0, 0x92, 0x03, 0xe1, 0xa0, 0x93, 0x03,
98+
0xe1, 0xa0, 0x94, 0x03, 0xe1, 0xa0, 0x95, 0x03, 0xe1, 0xa0, 0x96, 0x03,
99+
0xe1, 0xa0, 0x97, 0x03, 0xe1, 0xa0, 0x98, 0x03, 0xe1, 0xa0, 0x99, 0x03,
100+
0xe1, 0xb1, 0x90, 0x03, 0xe1, 0xb1, 0x91, 0x03, 0xe1, 0xb1, 0x92, 0x03,
101+
0xe1, 0xb1, 0x93, 0x03, 0xe1, 0xb1, 0x94, 0x03, 0xe1, 0xb1, 0x95, 0x03,
102+
0xe1, 0xb1, 0x96, 0x03, 0xe1, 0xb1, 0x97, 0x03, 0xe1, 0xb1, 0x98, 0x03,
103+
0xe1, 0xb1, 0x99, 0x03, 0xe3, 0x80, 0x87, 0x03, 0xe4, 0xb8, 0x80, 0x03,
104+
0xe4, 0xba, 0x8c, 0x03, 0xe4, 0xb8, 0x89, 0x03, 0xe5, 0x9b, 0x9b, 0x03,
105+
0xe4, 0xba, 0x94, 0x03, 0xe5, 0x85, 0xad, 0x03, 0xe4, 0xb8, 0x83, 0x03,
106+
0xe5, 0x85, 0xab, 0x03, 0xe4, 0xb9, 0x9d, 0x03, 0xea, 0x98, 0xa0, 0x03,
107+
0xea, 0x98, 0xa1, 0x03, 0xea, 0x98, 0xa2, 0x03, 0xea, 0x98, 0xa3, 0x03,
108+
0xea, 0x98, 0xa4, 0x03, 0xea, 0x98, 0xa5, 0x03, 0xea, 0x98, 0xa6, 0x03,
109+
0xea, 0x98, 0xa7, 0x03, 0xea, 0x98, 0xa8, 0x03, 0xea, 0x98, 0xa9, 0x03,
110+
0xea, 0xa7, 0x90, 0x03, 0xea, 0xa7, 0x91, 0x03, 0xea, 0xa7, 0x92, 0x03,
111+
0xea, 0xa7, 0x93, 0x03, 0xea, 0xa7, 0x94, 0x03, 0xea, 0xa7, 0x95, 0x03,
112+
0xea, 0xa7, 0x96, 0x03, 0xea, 0xa7, 0x97, 0x03, 0xea, 0xa7, 0x98, 0x03,
113+
0xea, 0xa7, 0x99, 0x03, 0xea, 0xaf, 0xb0, 0x03, 0xea, 0xaf, 0xb1, 0x03,
114+
0xea, 0xaf, 0xb2, 0x03, 0xea, 0xaf, 0xb3, 0x03, 0xea, 0xaf, 0xb4, 0x03,
115+
0xea, 0xaf, 0xb5, 0x03, 0xea, 0xaf, 0xb6, 0x03, 0xea, 0xaf, 0xb7, 0x03,
116+
0xea, 0xaf, 0xb8, 0x03, 0xea, 0xaf, 0xb9, 0x04, 0xf0, 0x91, 0x84, 0xb6,
117+
0x04, 0xf0, 0x91, 0x84, 0xb7, 0x04, 0xf0, 0x91, 0x84, 0xb8, 0x04, 0xf0,
118+
0x91, 0x84, 0xb9, 0x04, 0xf0, 0x91, 0x84, 0xba, 0x04, 0xf0, 0x91, 0x84,
119+
0xbb, 0x04, 0xf0, 0x91, 0x84, 0xbc, 0x04, 0xf0, 0x91, 0x84, 0xbd, 0x04,
120+
0xf0, 0x91, 0x84, 0xbe, 0x04, 0xf0, 0x91, 0x84, 0xbf, 0x04, 0xf0, 0x9e,
121+
0x85, 0x80, 0x04, 0xf0, 0x9e, 0x85, 0x81, 0x04, 0xf0, 0x9e, 0x85, 0x82,
122+
0x04, 0xf0, 0x9e, 0x85, 0x83, 0x04, 0xf0, 0x9e, 0x85, 0x84, 0x04, 0xf0,
123+
0x9e, 0x85, 0x85, 0x04, 0xf0, 0x9e, 0x85, 0x86, 0x04, 0xf0, 0x9e, 0x85,
124+
0x87, 0x04, 0xf0, 0x9e, 0x85, 0x88, 0x04, 0xf0, 0x9e, 0x85, 0x89, 0x04,
125+
0xf0, 0x9e, 0xa5, 0x90, 0x04, 0xf0, 0x9e, 0xa5, 0x91, 0x04, 0xf0, 0x9e,
126+
0xa5, 0x92, 0x04, 0xf0, 0x9e, 0xa5, 0x93, 0x04, 0xf0, 0x9e, 0xa5, 0x94,
127+
0x04, 0xf0, 0x9e, 0xa5, 0x95, 0x04, 0xf0, 0x9e, 0xa5, 0x96, 0x04, 0xf0,
128+
0x9e, 0xa5, 0x97, 0x04, 0xf0, 0x9e, 0xa5, 0x98, 0x04, 0xf0, 0x9e, 0xa5,
129+
0x99, 0x0e, 0x01, 0x01, 0x02, 0x02, 0x03, 0x04, 0x2d, 0x2b, 0x2e, 0x2c,
130+
0x62, 0x65, 0x6e, 0x67, 0x03, 0x02, 0x01, 0x0e, 0x01, 0x01, 0x02, 0x02,
131+
0x03, 0x04, 0x2d, 0x2b, 0x2e, 0x2c, 0x6c, 0x61, 0x74, 0x6e, 0x03, 0x02,
132+
0x01, 0x0e, 0x01, 0x01, 0x02, 0x02, 0x03, 0x04, 0x2d, 0x2b, 0x2e, 0x2c,
133+
0x6c, 0x61, 0x74, 0x6e, 0x03, 0x03, 0x01
134+
];
8135

9-
test('use createCompiled to format a simple decimal', async t => {
10136
const locale = Locale.fromString('bn');
11137

12-
const format = DecimalFormatter.createWithGroupingStrategy(locale, DecimalGroupingStrategy.Auto);
138+
const provider = DataProvider.fromByteSlice(bnBlob);
139+
140+
const format = DecimalFormatter.createWithGroupingStrategyAndProvider(provider, locale, DecimalGroupingStrategy.Auto);
13141

14142
const decimal = Decimal.fromNumber(1234);
15143
decimal.multiplyPow10(-2);

0 commit comments

Comments
 (0)