Function icu::properties::maps::load_script
source · [−]pub fn load_script(
provider: &impl DataProvider<ScriptV1Marker>
) -> Result<CodePointMapData<Script>, PropertiesError>
Expand description
Return a CodePointMapData
for the Script Unicode enumerated property. See [Script
].
Note: Some code points are associated with multiple scripts. If you are trying to
determine whether a code point belongs to a certain script, you should use
load_script_with_extensions_unstable
and ScriptWithExtensionsBorrowed::has_script
instead of this function.
Example
use icu::properties::{maps, Script};
use icu_collections::codepointtrie::CodePointTrie;
let data =
maps::load_script(&icu_testdata::unstable())
.expect("The data should be valid");
let script = data.as_borrowed();
assert_eq!(script.get('木'), Script::Han); // U+6728
assert_eq!(script.get('🎃'), Script::Common); // U+1F383 JACK-O-LANTERN