From a633485ab5ef89f03704cc0bb3459589109def31 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Fri, 25 Aug 2023 18:20:48 -0700 Subject: [PATCH] Fix up rust links --- ffi/diplomat/src/errors.rs | 4 ++-- ffi/diplomat/src/fixed_decimal.rs | 12 ++++++++---- tools/ffi_coverage/src/allowlist.rs | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ffi/diplomat/src/errors.rs b/ffi/diplomat/src/errors.rs index cd6210d0bc4..b01d5a98e45 100644 --- a/ffi/diplomat/src/errors.rs +++ b/ffi/diplomat/src/errors.rs @@ -5,7 +5,7 @@ use self::ffi::ICU4XError; use core::fmt; #[cfg(feature = "icu_decimal")] -use fixed_decimal::Error as FixedDecimalError; +use fixed_decimal::FixedDecimalError; #[cfg(any( feature = "icu_datetime", feature = "icu_timezone", @@ -45,7 +45,7 @@ pub mod ffi { /// A common enum for errors that ICU4X may return, organized by API /// /// The error names are stable and can be checked against as strings in the JS API - #[diplomat::rust_link(fixed_decimal::Error, Enum, compact)] + #[diplomat::rust_link(fixed_decimal::FixedDecimalError, Enum, compact)] #[diplomat::rust_link(icu::calendar::CalendarError, Enum, compact)] #[diplomat::rust_link(icu::collator::CollatorError, Enum, compact)] #[diplomat::rust_link(icu::datetime::DateTimeError, Enum, compact)] diff --git a/ffi/diplomat/src/fixed_decimal.rs b/ffi/diplomat/src/fixed_decimal.rs index cee6ec1781d..b30f0dc59ea 100644 --- a/ffi/diplomat/src/fixed_decimal.rs +++ b/ffi/diplomat/src/fixed_decimal.rs @@ -65,7 +65,8 @@ pub mod ffi { /// Construct an [`ICU4XFixedDecimal`] from an integer-valued float #[diplomat::rust_link(fixed_decimal::FixedDecimal::try_from_f64, FnInStruct)] - #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::FloatPrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum, hidden)] pub fn create_from_f64_with_integer_precision( f: f64, ) -> Result, ICU4XError> { @@ -77,7 +78,8 @@ pub mod ffi { /// Construct an [`ICU4XFixedDecimal`] from an float, with a given power of 10 for the lower magnitude #[diplomat::rust_link(fixed_decimal::FixedDecimal::try_from_f64, FnInStruct)] - #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::FloatPrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum, hidden)] pub fn create_from_f64_with_lower_magnitude( f: f64, magnitude: i16, @@ -90,7 +92,8 @@ pub mod ffi { /// Construct an [`ICU4XFixedDecimal`] from an float, for a given number of significant digits #[diplomat::rust_link(fixed_decimal::FixedDecimal::try_from_f64, FnInStruct)] - #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::FloatPrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum, hidden)] pub fn create_from_f64_with_significant_digits( f: f64, digits: u8, @@ -104,7 +107,8 @@ pub mod ffi { /// Construct an [`ICU4XFixedDecimal`] from an float, with enough digits to recover /// the original floating point in IEEE 754 without needing trailing zeros #[diplomat::rust_link(fixed_decimal::FixedDecimal::try_from_f64, FnInStruct)] - #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::FloatPrecision, Enum)] + #[diplomat::rust_link(fixed_decimal::DoublePrecision, Enum, hidden)] pub fn create_from_f64_with_floating_precision( f: f64, ) -> Result, ICU4XError> { diff --git a/tools/ffi_coverage/src/allowlist.rs b/tools/ffi_coverage/src/allowlist.rs index 94a0c01b425..f3d0b4bfcaa 100644 --- a/tools/ffi_coverage/src/allowlist.rs +++ b/tools/ffi_coverage/src/allowlist.rs @@ -329,6 +329,7 @@ lazy_static::lazy_static! { "icu::datetime::options::DateTimeFormatterOptions", // Re-exports of errors + "fixed_decimal::Error", "icu::calendar::Error", "icu::compactdecimal::Error", "icu::datetime::Error",