Skip to content

Commit

Permalink
ffi
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Nov 13, 2024
1 parent 9b72f4f commit c0bcfaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ffi/capi/src/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub mod ffi {
grouping_strategy: Option<FixedDecimalGroupingStrategy>,
) -> Result<Box<FixedDecimalFormatter>, DataError> {
use alloc::borrow::Cow;
use zerovec::VarZeroCow;
fn str_to_cow(s: &diplomat_runtime::DiplomatStr) -> Cow<'static, str> {
if s.is_empty() {
Cow::default()
Expand Down Expand Up @@ -102,7 +103,6 @@ pub mod ffi {
decimal_separator: str_to_cow(decimal_separator),
grouping_separator: str_to_cow(grouping_separator),
};
let strings = zerovec::ule::encode_varule_to_box(&strings);

let grouping_sizes = GroupingSizesV1 {
primary: primary_group_size,
Expand All @@ -117,7 +117,7 @@ pub mod ffi {
Ok(Box::new(FixedDecimalFormatter(
icu_decimal::FixedDecimalFormatter::try_new_unstable(
&icu_provider_adapters::fixed::FixedProvider::from_owned(DecimalSymbolsV1 {
strings: Cow::Owned(strings),
strings: VarZeroCow::from_encodeable(&strings),
grouping_sizes,
digits,
}),
Expand Down

0 comments on commit c0bcfaf

Please sign in to comment.