pub struct CaseMapUnfold<'data> {
pub map: ZeroMap<'data, PotentialUtf8, str>,
}
Expand description
Reverse case folding data. Maps from multi-character strings back to code-points that fold to those strings.
Fields§
§map: ZeroMap<'data, PotentialUtf8, str>
The actual map. Maps from strings to a list of codepoints, stored as a contiguous UTF-8 string
Implementations§
Source§impl CaseMapUnfold<'_>
impl CaseMapUnfold<'_>
Sourcepub fn try_from_icu(raw: &[u16]) -> Result<Self, DataError>
pub fn try_from_icu(raw: &[u16]) -> Result<Self, DataError>
Creates a new CaseMapUnfold using data exported by the icuexportdata
tool in ICU4C.
Unfold data is exported by ICU as an array of 16-bit values, representing a short header followed by a two-column key/value table. The header indicates:
- The number of rows.
- The number of UTF16 code units per row.
- The number of UTF16 code units in the first (key) column. (The number of code units in the value column can be derived from the above.)
The key in the first column is the case folding of each of the code points in the second column. Keys/values that are shorter than the column width are null-terminated. The table is sorted by key. Binary search is used to find the value.
Rust strings are UTF8 by default. To avoid the cost of converting from UTF16 on access, we convert the ICU data into a more convenient format during construction.
Trait Implementations§
Source§impl<'data> Bake for CaseMapUnfold<'data>
impl<'data> Bake for CaseMapUnfold<'data>
Source§fn bake(&self, env: &CrateEnv) -> TokenStream
fn bake(&self, env: &CrateEnv) -> TokenStream
Source§impl<'data> BakeSize for CaseMapUnfold<'data>
impl<'data> BakeSize for CaseMapUnfold<'data>
Source§fn borrows_size(&self) -> usize
fn borrows_size(&self) -> usize
Source§impl<'data> Clone for CaseMapUnfold<'data>
impl<'data> Clone for CaseMapUnfold<'data>
Source§fn clone(&self) -> CaseMapUnfold<'data>
fn clone(&self) -> CaseMapUnfold<'data>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'data> Debug for CaseMapUnfold<'data>
impl<'data> Debug for CaseMapUnfold<'data>
Source§impl<'de: 'data, 'data> Deserialize<'de> for CaseMapUnfold<'data>
impl<'de: 'data, 'data> Deserialize<'de> for CaseMapUnfold<'data>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl MaybeAsVarULE for CaseMapUnfold<'_>
impl MaybeAsVarULE for CaseMapUnfold<'_>
Source§type EncodedStruct = [()]
type EncodedStruct = [()]
VarULE
] type for this data struct, or [()]
if it cannot be represented as [VarULE
].Source§impl MaybeEncodeAsVarULE for CaseMapUnfold<'_>
impl MaybeEncodeAsVarULE for CaseMapUnfold<'_>
Source§fn maybe_encode_as_varule(&self) -> Option<&Self::EncodedStruct>
fn maybe_encode_as_varule(&self) -> Option<&Self::EncodedStruct>
MaybeAsVarULE::EncodedStruct
] that represents this data struct,
or None
if the data struct does not support this representation.Source§impl<'data> PartialEq for CaseMapUnfold<'data>
impl<'data> PartialEq for CaseMapUnfold<'data>
Source§impl<'data> Serialize for CaseMapUnfold<'data>
impl<'data> Serialize for CaseMapUnfold<'data>
Source§impl<'a> Yokeable<'a> for CaseMapUnfold<'static>
impl<'a> Yokeable<'a> for CaseMapUnfold<'static>
Source§type Output = CaseMapUnfold<'a>
type Output = CaseMapUnfold<'a>
Self
with the 'static
replaced with 'a
, i.e. Self<'a>
Source§fn transform_owned(self) -> Self::Output
fn transform_owned(self) -> Self::Output
Source§unsafe fn make(this: Self::Output) -> Self
unsafe fn make(this: Self::Output) -> Self
Self<'a>
’s lifetime. Read moreSource§fn transform_mut<F>(&'a mut self, f: F)where
F: 'static + for<'b> FnOnce(&'b mut Self::Output),
fn transform_mut<F>(&'a mut self, f: F)where
F: 'static + for<'b> FnOnce(&'b mut Self::Output),
self
between &'a mut Self<'static>
and &'a mut Self<'a>
,
and pass it to f
. Read moreSource§impl<'zf, 'zf_inner> ZeroFrom<'zf, CaseMapUnfold<'zf_inner>> for CaseMapUnfold<'zf>
impl<'zf, 'zf_inner> ZeroFrom<'zf, CaseMapUnfold<'zf_inner>> for CaseMapUnfold<'zf>
Source§fn zero_from(this: &'zf CaseMapUnfold<'zf_inner>) -> Self
fn zero_from(this: &'zf CaseMapUnfold<'zf_inner>) -> Self
C
into a struct that may retain references into C
.impl<'data> StructuralPartialEq for CaseMapUnfold<'data>
Auto Trait Implementations§
impl<'data> Freeze for CaseMapUnfold<'data>
impl<'data> RefUnwindSafe for CaseMapUnfold<'data>
impl<'data> Send for CaseMapUnfold<'data>
impl<'data> Sync for CaseMapUnfold<'data>
impl<'data> Unpin for CaseMapUnfold<'data>
impl<'data> UnwindSafe for CaseMapUnfold<'data>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more