Skip to content

Commit 56506a7

Browse files
authored
More DateTime FFI rustlink and export fixes (#6501)
Toward #5940
1 parent d5cbc56 commit 56506a7

File tree

13 files changed

+43
-41
lines changed

13 files changed

+43
-41
lines changed

components/datetime/src/error.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,3 @@ pub enum DateTimeWriteError {
133133
}
134134

135135
impl core::error::Error for DateTimeWriteError {}
136-
137-
/// Error returned from constructors that map from AnyCalendar to a formatter.
138-
#[derive(Debug, Clone, Copy, PartialEq, displaydoc::Display)]
139-
#[displaydoc("The calendar {kind:?} is not supported in DateTimeFormatter")]
140-
#[non_exhaustive]
141-
pub struct UnsupportedCalendarError {
142-
/// The calendar kind that is not supported.
143-
pub kind: AnyCalendarKind,
144-
}
145-
146-
impl core::error::Error for UnsupportedCalendarError {}

components/datetime/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ pub(crate) mod raw;
106106
pub mod scaffold;
107107
pub(crate) mod size_test_macro;
108108

109-
pub use error::{
110-
DateTimeFormatterLoadError, DateTimeWriteError, MismatchedCalendarError,
111-
UnsupportedCalendarError,
112-
};
109+
pub use error::{DateTimeFormatterLoadError, DateTimeWriteError, MismatchedCalendarError};
113110

114111
pub use format::DateTimeInputUnchecked;
115112
pub use neo::DateTimeFormatter;

components/datetime/src/pattern/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ mod pattern;
1818
pub use crate::error::ErrorField;
1919
pub use formatter::DateTimePatternFormatter;
2020
pub use formatter::FormattedDateTimePattern;
21+
use icu_calendar::AnyCalendarKind;
2122
use icu_pattern::SinglePlaceholderPattern;
2223
pub use names::DateTimeNames;
2324
pub(crate) use names::DateTimeNamesMetadata;
@@ -98,3 +99,14 @@ pub enum PatternLoadError {
9899
}
99100

100101
impl core::error::Error for PatternLoadError {}
102+
103+
/// Error returned from constructors that map from AnyCalendar to a formatter.
104+
#[derive(Debug, Clone, Copy, PartialEq, displaydoc::Display)]
105+
#[displaydoc("The calendar {kind:?} is not supported in DateTimeFormatter")]
106+
#[non_exhaustive]
107+
pub struct UnsupportedCalendarError {
108+
/// The calendar kind that is not supported.
109+
pub kind: AnyCalendarKind,
110+
}
111+
112+
impl core::error::Error for UnsupportedCalendarError {}

components/datetime/src/pattern/names.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
use super::{
66
DateTimePattern, DateTimePatternFormatter, GetNameForCyclicYearError, GetNameForDayPeriodError,
77
GetNameForEraError, GetNameForMonthError, GetNameForWeekdayError, MonthPlaceholderValue,
8-
PatternLoadError,
8+
PatternLoadError, UnsupportedCalendarError,
99
};
10-
use crate::error::{ErrorField, UnsupportedCalendarError};
10+
use crate::error::ErrorField;
1111
use crate::fieldsets::enums::{CompositeDateTimeFieldSet, CompositeFieldSet};
1212
use crate::provider::fields::{self, FieldLength, FieldSymbol};
1313
use crate::provider::neo::{marker_attrs, *};

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

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

ffi/capi/bindings/dart/TimeFormatter.g.dart

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

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

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

ffi/capi/bindings/js/TimeFormatter.mjs

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

ffi/capi/src/time_formatter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub mod ffi {
4040

4141
impl TimeFormatter {
4242
#[diplomat::attr(supports = fallible_constructors, constructor)]
43-
#[diplomat::rust_link(icu::datetime::NoCalendarFormatter::try_new, FnInStruct)]
43+
#[diplomat::rust_link(icu::datetime::NoCalendarFormatter::try_new, FnInTypedef)]
4444
#[diplomat::rust_link(icu::datetime::fieldsets::T, Struct)]
4545
#[diplomat::rust_link(icu::datetime::fieldsets::T::hm, FnInStruct, hidden)]
4646
#[diplomat::rust_link(icu::datetime::fieldsets::T::hms, FnInStruct, hidden)]
@@ -81,7 +81,7 @@ pub mod ffi {
8181
}
8282

8383
#[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "with_provider")]
84-
#[diplomat::rust_link(icu::datetime::NoCalendarFormatter::try_new, FnInStruct)]
84+
#[diplomat::rust_link(icu::datetime::NoCalendarFormatter::try_new, FnInTypedef)]
8585
#[diplomat::rust_link(icu::datetime::fieldsets::T, Struct)]
8686
#[diplomat::rust_link(icu::datetime::fieldsets::T::hm, FnInStruct, hidden)]
8787
#[diplomat::rust_link(icu::datetime::fieldsets::T::hms, FnInStruct, hidden)]
@@ -122,7 +122,7 @@ pub mod ffi {
122122
)))
123123
}
124124

125-
#[diplomat::rust_link(icu::datetime::FixedCalendarDateTimeFormatter::format, FnInStruct)]
125+
#[diplomat::rust_link(icu::datetime::NoCalendarFormatter::format, FnInTypedef)]
126126
#[diplomat::rust_link(icu::datetime::FormattedDateTime, Struct, hidden)]
127127
#[diplomat::rust_link(icu::datetime::FormattedDateTime::to_string, FnInStruct, hidden)]
128128
pub fn format(

ffi/capi/tests/missing_apis.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515

1616

1717
fixed_decimal::Decimal::new#FnInTypedef
18-
icu::datetime::NoCalendarFormatter::cast_into_fset#FnInTypedef
19-
icu::datetime::NoCalendarFormatter::format#FnInTypedef
20-
icu::datetime::NoCalendarFormatter::format_unchecked#FnInTypedef
21-
icu::datetime::NoCalendarFormatter::into_formatter#FnInTypedef
22-
icu::datetime::NoCalendarFormatter::to_field_set_builder#FnInTypedef
23-
icu::datetime::NoCalendarFormatter::try_new#FnInTypedef
24-
icu::datetime::UnsupportedCalendarError#Struct
2518
icu::datetime::options::SubsecondError#Enum
2619
icu_provider_adapters::fork::ForkByMarkerProvider::inner#FnInTypedef
2720
icu_provider_adapters::fork::ForkByMarkerProvider::inner_mut#FnInTypedef

0 commit comments

Comments
 (0)