// Provider structs must be stable #![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)]
//! \[Unstable\] Data provider struct definitions for this ICU4X component. //! //! <div class="stab unstable"> //! This code is considered unstable; it may change at any time, in breaking or non-breaking ways, //! including in SemVer minor releases. While the serde representation of data structs is guaranteed //! to be stable, their Rust representation might not be. Use with caution. //! </div> //! //! Read more about data providers: [`icu_provider`]
use core::ops::RangeInclusive; use core::str; use icu_collections::codepointinvlist::CodePointInversionList; use icu_collections::codepointinvliststringlist::CodePointInversionListAndStringList; use icu_collections::codepointtrie::{CodePointMapRange, CodePointTrie, TrieValue}; use icu_provider::prelude::*; use icu_provider::{DataKeyMetadata, FallbackPriority}; use zerofrom::ZeroFrom;
use zerovec::{VarZeroVec, ZeroSlice, ZeroVecError};
#[cfg(feature = "compiled_data")] #[derive(Debug)] /// Baked data /// /// <div class="stab unstable"> /// This code is considered unstable; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. In particular, the `DataProvider` implementations are only /// guaranteed to match with this version's `*_unstable` providers. Use with caution. /// </div> pubstruct Baked;
// include the specialized structs for the compact representation of Bidi property data pubmod bidi_data;
/// A set of characters which share a particular property value. /// /// This data enum is extensible, more backends may be added in the future. /// Old data can be used with newer code but not vice versa. /// /// <div class="stab unstable"> /// This code is considered unstable; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. While the serde representation of data structs is guaranteed /// to be stable, their Rust representation might not be. Use with caution. /// </div> #[derive(Debug, Eq, PartialEq, Clone, yoke::Yokeable, zerofrom::ZeroFrom)] #[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_properties::provider),
)] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] #[non_exhaustive] pubenum PropertyCodePointSetV1<'data> { /// The set of characters, represented as an inversion list
InversionList(#[cfg_attr(feature = "serde", serde(borrow))] CodePointInversionList<'data>), // new variants should go BELOW existing ones // Serde serializes based on variant name and index in the enum // https://docs.rs/serde/latest/serde/trait.Serializer.html#tymethod.serialize_unit_variant
}
/// A map efficiently storing data about individual characters. /// /// This data enum is extensible, more backends may be added in the future. /// Old data can be used with newer code but not vice versa. /// /// <div class="stab unstable"> /// This code is considered unstable; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. While the serde representation of data structs is guaranteed /// to be stable, their Rust representation might not be. Use with caution. /// </div> #[derive(Clone, Debug, Eq, PartialEq, yoke::Yokeable, zerofrom::ZeroFrom)] #[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_properties::provider),
)] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] #[non_exhaustive] pubenum PropertyCodePointMapV1<'data, T: TrieValue> { /// A codepoint trie storing the data
CodePointTrie(#[cfg_attr(feature = "serde", serde(borrow))] CodePointTrie<'data, T>), // new variants should go BELOW existing ones // Serde serializes based on variant name and index in the enum // https://docs.rs/serde/latest/serde/trait.Serializer.html#tymethod.serialize_unit_variant
}
/// A set of characters and strings which share a particular property value. /// /// <div class="stab unstable"> /// This code is considered unstable; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. While the serde representation of data structs is guaranteed /// to be stable, their Rust representation might not be. Use with caution. /// </div> #[derive(Debug, Eq, PartialEq, Clone, yoke::Yokeable, zerofrom::ZeroFrom)] #[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_properties::provider),
)] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] #[non_exhaustive] pubenum PropertyUnicodeSetV1<'data> { /// A set representing characters in an inversion list, and the strings in a list.
CPInversionListStrList( #[cfg_attr(feature = "serde", serde(borrow))] CodePointInversionListAndStringList<'data>,
), // new variants should go BELOW existing ones // Serde serializes based on variant name and index in the enum // https://docs.rs/serde/latest/serde/trait.Serializer.html#tymethod.serialize_unit_variant
}
#[inline] pub(crate) fn as_code_point_inversion_list_string_list(
&'_ self,
) -> Option<&'_ CodePointInversionListAndStringList<'data>> { match *self { Self::CPInversionListStrList(ref l) => Some(l), // any other backing data structure that cannot return a CPInversionListStrList in O(1) time should return None
}
}
/// A struct that efficiently stores `Script` and `Script_Extensions` property data. /// /// <div class="stab unstable"> /// This code is considered unstable; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. While the serde representation of data structs is guaranteed /// to be stable, their Rust representation might not be. Use with caution. /// </div> #[icu_provider::data_struct(marker(
ScriptWithExtensionsPropertyV1Marker, "props/scx@1",
singleton
))] #[derive(Debug, Eq, PartialEq, Clone)] #[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_properties::provider),
)] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] pubstruct ScriptWithExtensionsPropertyV1<'data> { /// Note: The `ScriptWithExt` values in this array will assume a 12-bit layout. The 2 /// higher order bits 11..10 will indicate how to deduce the Script value and /// Script_Extensions value, nearly matching the representation /// [in ICU](https://github.com/unicode-org/icu/blob/main/icu4c/source/common/uprops.h): /// /// | High order 2 bits value | Script | Script_Extensions | /// |-------------------------|--------------------------------------------------------|----------------------------------------------------------------| /// | 3 | First value in sub-array, index given by lower 10 bits | Sub-array excluding first value, index given by lower 10 bits | /// | 2 | Script=Inherited | Entire sub-array, index given by lower 10 bits | /// | 1 | Script=Common | Entire sub-array, index given by lower 10 bits | /// | 0 | Value in lower 10 bits | `[ Script value ]` single-element array | /// /// When the lower 10 bits of the value are used as an index, that index is /// used for the outer-level vector of the nested `extensions` structure. #[cfg_attr(feature = "serde", serde(borrow))] pub trie: CodePointTrie<'data, ScriptWithExt>,
/// This companion structure stores Script_Extensions values, which are /// themselves arrays / vectors. This structure only stores the values for /// cases in which `scx(cp) != [ sc(cp) ]`. Each sub-vector is distinct. The /// sub-vector represents the Script_Extensions array value for a code point, /// and may also indicate Script value, as described for the `trie` field. #[cfg_attr(feature = "serde", serde(borrow))] pub extensions: VarZeroVec<'data, ZeroSlice<Script>>,
}
impl<'data> ScriptWithExtensionsPropertyV1<'data> { // This method is intended to be used by constructors of deserialized data // in a data provider. #[doc(hidden)] pubfn new(
trie: CodePointTrie<'data, ScriptWithExt>,
extensions: VarZeroVec<'data, ZeroSlice<Script>>,
) -> ScriptWithExtensionsPropertyV1<'data> {
ScriptWithExtensionsPropertyV1 { trie, extensions }
}
}
// See CodePointSetData for documentation of these functions impl<'data> PropertyCodePointSetV1<'data> { #[inline] pub(crate) fn contains(&self, ch: char) -> bool { match *self { Self::InversionList(ref l) => l.contains(ch),
}
}
#[inline] pub(crate) fn as_code_point_inversion_list(
&'_ self,
) -> Option<&'_ CodePointInversionList<'data>> { match *self { Self::InversionList(ref l) => Some(l), // any other backing data structure that cannot return a CPInvList in O(1) time should return None
}
}
#[inline] pub(crate) fn as_code_point_trie(&self) -> Option<&CodePointTrie<'data, T>> { match *self { Self::CodePointTrie(ref t) => Some(t), // any other backing data structure that cannot return a CPT in O(1) time should return None
}
}
#[doc = core::concat!("Data marker for producing long names of the values of the '", $enum_s, "' Unicode property")] #[derive(Debug, Default)] #[cfg_attr(
feature = "datagen",
derive(databake::Bake),
databake(path = icu_properties::provider),
)] pubstruct $value_long_name_marker_linear4;
impl DataMarker for $value_long_name_marker_linear4 { // Tiny4 is only for short names type Yokeable = names::PropertyEnumToValueNameLinearMapV1<'static>;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-20)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.