#[diplomat::bridge]
#[diplomat::abi_rename = "icu4x_{0}_mv1"]
#[diplomat::attr(auto, namespace = "icu4x")]
pub mod ffi {
use alloc::boxed::Box;
#[cfg(any(feature = "compiled_data", feature = "buffer_provider"))]
use icu_properties::props::BasicEmoji;
#[cfg(feature = "buffer_provider")]
use crate::{errors::ffi::DataError, provider::ffi::DataProvider};
#[diplomat::opaque]
#[diplomat::rust_link(icu::properties, Mod)]
#[diplomat::rust_link(icu::properties::EmojiSetData, Struct)]
#[diplomat::rust_link(icu::properties::EmojiSetData::new, FnInStruct)]
#[diplomat::rust_link(icu::properties::EmojiSetDataBorrowed, Struct)]
pub struct EmojiSetData(pub icu_properties::EmojiSetData);
impl EmojiSetData {
#[diplomat::rust_link(icu::properties::EmojiSetDataBorrowed::contains_str, FnInStruct)]
#[diplomat::attr(supports = method_overloading, rename = "contains")]
pub fn contains_str(&self, s: &DiplomatStr) -> bool {
let Ok(s) = core::str::from_utf8(s) else {
return false;
};
self.0.as_borrowed().contains_str(s)
}
#[diplomat::rust_link(icu::properties::EmojiSetDataBorrowed::contains, FnInStruct)]
#[diplomat::rust_link(
icu::properties::EmojiSetDataBorrowed::contains32,
FnInStruct,
hidden
)]
pub fn contains(&self, cp: DiplomatChar) -> bool {
self.0.as_borrowed().contains32(cp)
}
#[diplomat::rust_link(icu::properties::props::BasicEmoji, Struct)]
#[diplomat::attr(auto, named_constructor = "basic")]
#[cfg(feature = "compiled_data")]
pub fn create_basic() -> Box<EmojiSetData> {
Box::new(EmojiSetData(
icu_properties::EmojiSetData::new::<BasicEmoji>().static_to_owned(),
))
}
#[diplomat::rust_link(icu::properties::props::BasicEmoji, Struct)]
#[diplomat::attr(supports = fallible_constructors, named_constructor = "basic_with_provider")]
#[cfg(feature = "buffer_provider")]
pub fn create_basic_with_provider(
provider: &DataProvider,
) -> Result<Box<EmojiSetData>, DataError> {
Ok(Box::new(EmojiSetData(call_constructor_unstable!(
icu_properties::EmojiSetData::try_new_unstable::<BasicEmoji>,
provider,
)?)))
}
}
}