Skip to content

Commit 6bc1e13

Browse files
committed
ffi
1 parent 96ac79d commit 6bc1e13

File tree

13 files changed

+594
-0
lines changed

13 files changed

+594
-0
lines changed

ffi/capi/bindings/c/IndicConjunctBreak.d.h

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

ffi/capi/bindings/c/IndicConjunctBreak.h

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

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

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

ffi/capi/bindings/cpp/icu4x/IndicConjunctBreak.hpp

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

ffi/capi/src/properties_enums.rs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,6 +2549,66 @@ pub mod ffi {
25492549
}
25502550
}
25512551

2552+
#[diplomat::rust_link(icu::properties::props::IndicConjunctBreak, Struct)]
2553+
#[diplomat::enum_convert(icu_properties::props::IndicConjunctBreak, needs_wildcard)]
2554+
#[non_exhaustive]
2555+
pub enum IndicConjunctBreak {
2556+
#[diplomat::rust_link(
2557+
icu::properties::props::IndicConjunctBreak::None,
2558+
AssociatedConstantInStruct
2559+
)]
2560+
None = 0,
2561+
#[diplomat::rust_link(
2562+
icu::properties::props::IndicConjunctBreak::Consonant,
2563+
AssociatedConstantInStruct
2564+
)]
2565+
Consonant = 1,
2566+
#[diplomat::rust_link(
2567+
icu::properties::props::IndicConjunctBreak::Extend,
2568+
AssociatedConstantInStruct
2569+
)]
2570+
Extend = 2,
2571+
#[diplomat::rust_link(
2572+
icu::properties::props::IndicConjunctBreak::Linker,
2573+
AssociatedConstantInStruct
2574+
)]
2575+
Linker = 3,
2576+
}
2577+
2578+
impl IndicConjunctBreak {
2579+
#[diplomat::rust_link(icu::properties::props::EnumeratedProperty::for_char, FnInTrait)]
2580+
#[cfg(feature = "compiled_data")]
2581+
pub fn for_char(ch: DiplomatChar) -> Self {
2582+
icu_properties::CodePointMapData::<props::IndicConjunctBreak>::new()
2583+
.get32(ch)
2584+
.into()
2585+
}
2586+
#[diplomat::rust_link(
2587+
icu::properties::props::IndicConjunctBreak::to_icu4c_value,
2588+
FnInStruct
2589+
)]
2590+
#[diplomat::attr(demo_gen, disable)] // semi-internal, also too many of these
2591+
/// Convert to an integer value usable with ICU4C and CodePointMapData
2592+
pub fn to_integer_value(self) -> u8 {
2593+
self as u8
2594+
}
2595+
#[diplomat::rust_link(
2596+
icu::properties::props::IndicConjunctBreak::from_icu4c_value,
2597+
FnInStruct
2598+
)]
2599+
#[diplomat::attr(demo_gen, disable)] // semi-internal, also too many of these
2600+
/// Convert from an integer value from ICU4C or CodePointMapData
2601+
pub fn from_integer_value(other: u8) -> Option<Self> {
2602+
Some(match other {
2603+
0 => Self::None,
2604+
1 => Self::Consonant,
2605+
2 => Self::Extend,
2606+
3 => Self::Linker,
2607+
_ => return None,
2608+
})
2609+
}
2610+
}
2611+
25522612
#[diplomat::rust_link(icu::properties::props::JoiningType, Struct)]
25532613
#[diplomat::enum_convert(icu_properties::props::JoiningType, needs_wildcard)]
25542614
#[non_exhaustive]
@@ -3084,6 +3144,12 @@ mod test {
30843144
assert_eq!(prop.to_icu4c_value(), ffi_prop.to_integer_value());
30853145
assert_eq!(*prop, props::IndicSyllabicCategory::from(ffi_prop));
30863146
}
3147+
for prop in props::IndicConjunctBreak::ALL_VALUES {
3148+
let ffi_prop = IndicConjunctBreak::from_integer_value(prop.to_icu4c_value())
3149+
.expect("Found IndicConjunctBreak value not supported in ffi");
3150+
assert_eq!(prop.to_icu4c_value(), ffi_prop.to_integer_value());
3151+
assert_eq!(*prop, props::IndicConjunctBreak::from(ffi_prop));
3152+
}
30873153
for prop in props::JoiningType::ALL_VALUES {
30883154
let ffi_prop = JoiningType::from_integer_value(prop.to_icu4c_value())
30893155
.expect("Found JoiningType value not supported in ffi");
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// generated by diplomat-tool
2+
// dart format off
3+
4+
part of 'lib.g.dart';
5+
6+
/// See the [Rust documentation for `IndicConjunctBreak`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.IndicConjunctBreak.html) for more information.
7+
enum IndicConjunctBreak {
8+
/// See the [Rust documentation for `None`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.IndicConjunctBreak.html#associatedconstant.None) for more information.
9+
// ignore: public_member_api_docs
10+
none,
11+
/// See the [Rust documentation for `Consonant`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.IndicConjunctBreak.html#associatedconstant.Consonant) for more information.
12+
// ignore: public_member_api_docs
13+
consonant,
14+
/// See the [Rust documentation for `Extend`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.IndicConjunctBreak.html#associatedconstant.Extend) for more information.
15+
// ignore: public_member_api_docs
16+
extend,
17+
/// See the [Rust documentation for `Linker`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.IndicConjunctBreak.html#associatedconstant.Linker) for more information.
18+
// ignore: public_member_api_docs
19+
linker;
20+
21+
/// See the [Rust documentation for `for_char`](https://docs.rs/icu/2.1.1/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information.
22+
static IndicConjunctBreak forChar(Rune ch) {
23+
final result = _icu4x_IndicConjunctBreak_for_char_mv1(ch);
24+
return IndicConjunctBreak.values[result];
25+
}
26+
27+
/// Convert to an integer value usable with ICU4C and CodePointMapData
28+
///
29+
/// See the [Rust documentation for `to_icu4c_value`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.IndicConjunctBreak.html#method.to_icu4c_value) for more information.
30+
int toIntegerValue() {
31+
final result = _icu4x_IndicConjunctBreak_to_integer_value_mv1(index);
32+
return result;
33+
}
34+
35+
/// Convert from an integer value from ICU4C or CodePointMapData
36+
///
37+
/// See the [Rust documentation for `from_icu4c_value`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.IndicConjunctBreak.html#method.from_icu4c_value) for more information.
38+
static IndicConjunctBreak? fromIntegerValue(int other) {
39+
final result = _icu4x_IndicConjunctBreak_from_integer_value_mv1(other);
40+
if (!result.isOk) {
41+
return null;
42+
}
43+
return IndicConjunctBreak.values[result.union.ok];
44+
}
45+
46+
}
47+
48+
@_DiplomatFfiUse('icu4x_IndicConjunctBreak_for_char_mv1')
49+
@ffi.Native<ffi.Int32 Function(ffi.Uint32)>(isLeaf: true, symbol: 'icu4x_IndicConjunctBreak_for_char_mv1')
50+
// ignore: non_constant_identifier_names
51+
external int _icu4x_IndicConjunctBreak_for_char_mv1(Rune ch);
52+
53+
@_DiplomatFfiUse('icu4x_IndicConjunctBreak_to_integer_value_mv1')
54+
@ffi.Native<ffi.Uint8 Function(ffi.Int32)>(isLeaf: true, symbol: 'icu4x_IndicConjunctBreak_to_integer_value_mv1')
55+
// ignore: non_constant_identifier_names
56+
external int _icu4x_IndicConjunctBreak_to_integer_value_mv1(int self);
57+
58+
@_DiplomatFfiUse('icu4x_IndicConjunctBreak_from_integer_value_mv1')
59+
@ffi.Native<_ResultInt32Void Function(ffi.Uint8)>(isLeaf: true, symbol: 'icu4x_IndicConjunctBreak_from_integer_value_mv1')
60+
// ignore: non_constant_identifier_names
61+
external _ResultInt32Void _icu4x_IndicConjunctBreak_from_integer_value_mv1(int other);
62+
63+
// dart format on

ffi/dart/lib/src/bindings/lib.g.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ part 'GraphemeClusterSegmenter.g.dart';
8989
part 'HangulSyllableType.g.dart';
9090
part 'IanaParser.g.dart';
9191
part 'IanaParserExtended.g.dart';
92+
part 'IndicConjunctBreak.g.dart';
9293
part 'IndicSyllabicCategory.g.dart';
9394
part 'IsoDate.g.dart';
9495
part 'IsoDateTime.g.dart';

0 commit comments

Comments
 (0)