@@ -57,23 +57,17 @@ pub mod ffi {
57
57
58
58
impl {{ ffi_type }} {
59
59
{% - for variant in variants %}
60
- {% - for is_with_provider in [false , true ] %}
61
- {% - let ctor_suffix_ffi %}
62
- {% - let ctor_suffix_rust %}
63
- {% - let cargo_feature %}
60
+ {% - for ctor in ConstructorType ::VALUES %}
64
61
{% - let named_constructor %}
65
62
{% - let named_constructor_full %}
66
- {% - if is_with_provider %}
63
+ {% - if ctor . is_with_provider () %}
67
64
{% - if variant .is_only_constructor () %}
68
65
{% - let named_constructor = "with_provider" .to_string () %}
69
66
{% - let named_constructor_full = "create_with_provider" .to_string () %}
70
67
{% - else %}
71
68
{% - let named_constructor = format !("{}_with_provider" , variant .name_lower ()) %}
72
69
{% - let named_constructor_full = format !("create_{}_with_provider" , variant .name_lower ()) %}
73
70
{% - endif %}
74
- {% - let ctor_suffix_ffi = "with_provider" %}
75
- {% - let ctor_suffix_rust = "_with_buffer_provider" %}
76
- {% - let cargo_feature = "buffer_provider" %}
77
71
{% - else %}
78
72
{% - if variant .is_only_constructor () %}
79
73
{% - let named_constructor = "" .to_string () %}
@@ -82,9 +76,6 @@ pub mod ffi {
82
76
{% - let named_constructor = format !("{}" , variant .name_lower ()) %}
83
77
{% - let named_constructor_full = format !("create_{}" , variant .name_lower ()) %}
84
78
{% - endif %}
85
- {% - let ctor_suffix_ffi = "" %}
86
- {% - let ctor_suffix_rust = "" %}
87
- {% - let cargo_feature = "compiled_data" %}
88
79
{% - endif %}
89
80
{% - if named_constructor == "" %}
90
81
#[diplomat::attr(supports = fallible_constructors, constructor)]
@@ -105,12 +96,12 @@ pub mod ffi {
105
96
#[diplomat::rust_link(icu::datetime::fieldsets::{{ variant.name_upper() }}::short, FnInStruct, hidden)]
106
97
#[diplomat::rust_link(icu::datetime::fieldsets::{{ variant.name_upper() }}::medium, FnInStruct, hidden)]
107
98
#[diplomat::rust_link(icu::datetime::fieldsets::{{ variant.name_upper() }}::long, FnInStruct, hidden)]
108
- {% - if variant .is_default_constructor () && !is_with_provider %}
99
+ {% - if variant .is_default_constructor () && !ctor . is_with_provider () %}
109
100
#[diplomat::demo(default_constructor)]
110
101
{% - endif %}
111
- #[cfg(feature = "{{ cargo_feature }}")]
102
+ #[cfg(feature = "{{ ctor. cargo_feature() }}")]
112
103
pub fn {{ named_constructor_full }}(
113
- {% - if is_with_provider %}
104
+ {% - if ctor . is_with_provider () %}
114
105
provider: &DataProvider,
115
106
{% - endif %}
116
107
locale: &Locale,
@@ -142,8 +133,8 @@ pub mod ffi {
142
133
Ok(Box::new(Self(
143
134
icu_datetime
144
135
::{{ formatter_kind.rust_type() }}
145
- ::try_new{{ ctor_suffix_rust }}(
146
- {% - if is_with_provider %}
136
+ ::try_new{{ ctor.suffix_rust() }}(
137
+ {% - if ctor . is_with_provider () %}
147
138
provider.get()?,
148
139
{% - endif %}
149
140
prefs,
0 commit comments