-
Notifications
You must be signed in to change notification settings - Fork 213
Adds UnicodePropertyMapV1 data struct for enumerated properties #1161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iainireland
merged 9 commits into
unicode-org:main
from
iainireland:cpt-provider-struct
Oct 18, 2021
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d83a0e3
Rename TrieTypeEnum to TrieType
iainireland 6b64fdb
Implement Yokeable/ZeroCopyFrom for CodePointTrie and data struct
iainireland 2e79cef
Cargo fmt + minor fixes
iainireland 106eb28
Rebase on yoke-generics
iainireland 0087396
Add doc comments
iainireland 18f2556
Address feedback
iainireland ac13151
Add additional derives
iainireland f9b74ca
Update comment on DATA_GET_ERROR_VALUE
iainireland 57ac8ed
Cargo fmt
iainireland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ pub mod codepointtrie; | |
pub mod error; | ||
mod impl_const; | ||
pub mod planes; | ||
pub mod provider; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This file is part of ICU4X. For terms of use, please see the file | ||
// called LICENSE at the top level of the ICU4X source tree | ||
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). | ||
|
||
//! Data provider struct definitions for this ICU4X component. | ||
//! | ||
//! Read more about data providers: [`icu_provider`] | ||
|
||
use crate::codepointtrie::{CodePointTrie, TrieValue}; | ||
use icu_provider::yoke::{self, Yokeable, ZeroCopyFrom}; | ||
|
||
/// A map efficiently storing data about individual characters. | ||
#[derive(Debug, Eq, PartialEq, Yokeable, ZeroCopyFrom)] | ||
#[cfg_attr( | ||
feature = "provider_serde", | ||
derive(serde::Serialize, serde::Deserialize) | ||
)] | ||
pub struct UnicodePropertyMapV1<'data, T: TrieValue> { | ||
/// A codepoint trie storing the data | ||
#[cfg_attr(feature = "provider_serde", serde(borrow))] | ||
pub codepoint_trie: CodePointTrie<'data, T>, | ||
} | ||
|
||
impl<'data, T: TrieValue> Clone for UnicodePropertyMapV1<'data, T> | ||
where | ||
<T as zerovec::ule::AsULE>::ULE: Clone, | ||
{ | ||
fn clone(&self) -> Self { | ||
UnicodePropertyMapV1 { | ||
codepoint_trie: self.codepoint_trie.clone(), | ||
} | ||
} | ||
} | ||
|
||
/// Marker type for UnicodePropertyMapV1. | ||
/// This is generated by hand because icu_provider::data_struct doesn't support generics yet. | ||
pub struct UnicodePropertyMapV1Marker<T: TrieValue> { | ||
_phantom: core::marker::PhantomData<T>, | ||
} | ||
|
||
impl<'data, T: TrieValue> icu_provider::DataMarker<'data> for UnicodePropertyMapV1Marker<T> { | ||
type Yokeable = UnicodePropertyMapV1<'static, T>; | ||
type Cart = UnicodePropertyMapV1<'data, T>; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.