Struct unicode_script::ScriptExtension
source · #[non_exhaustive]pub struct ScriptExtension {
pub(crate) first: u64,
pub(crate) second: u64,
pub(crate) third: u64,
pub(crate) common: bool,
}
Expand description
A value for the Script_Extension
property
ScriptExtension
is one or more Script
This is essentially an optimized version of Vec<Script>
that uses bitfields
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.first: u64
§second: u64
§third: u64
§common: bool
Implementations§
source§impl ScriptExtension
impl ScriptExtension
pub(crate) const THIRD_MAX: u64 = 1_099_511_627_775u64
pub(crate) const fn new(first: u64, second: u64, third: u64) -> Self
pub(crate) const fn new_common() -> Self
pub(crate) const fn new_inherited() -> Self
pub(crate) const fn new_unknown() -> Self
pub(crate) const fn is_common_or_inherited(self) -> bool
sourcepub const fn is_inherited(self) -> bool
pub const fn is_inherited(self) -> bool
Checks if the script extension is Inherited
sourcepub fn intersect_with(&mut self, other: Self)
pub fn intersect_with(&mut self, other: Self)
Intersect this ScriptExtension
with another ScriptExtension
. Produces Unknown
if things
do not intersect. This is equivalent to ScriptExtension::intersection
but it stores the result
in self
“Common” (Zyyy
) and “Inherited” (Zinh
) are considered as intersecting
everything, the intersection of Common
and Inherited
is Inherited
sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Find the intersection between two ScriptExtensions. Returns Unknown if things do not intersect.
“Common” (Zyyy
) and “Inherited” (Zinh
) are considered as intersecting
everything, the intersection of Common
and Inherited
is Inherited
sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Find the union between two ScriptExtensions.
“Common” (Zyyy
) and “Inherited” (Zinh
) are considered as intersecting
everything, the union of Common
and Inherited
is Common
sourcepub fn contains_script(self, script: Script) -> bool
pub fn contains_script(self, script: Script) -> bool
Check if this ScriptExtension contains the given script
Should be used with specific scripts only, this will
return true
if self
is not Unknown
and script
is
Common
or Inherited
sourcepub fn for_str(x: &str) -> Self
pub fn for_str(x: &str) -> Self
Get the intersection of script extensions of all characters in a string.
sourcepub fn iter(self) -> ScriptIterator ⓘ
pub fn iter(self) -> ScriptIterator ⓘ
Iterate over the scripts in this script extension
Will never yield Script::Unknown
Trait Implementations§
source§impl Clone for ScriptExtension
impl Clone for ScriptExtension
source§fn clone(&self) -> ScriptExtension
fn clone(&self) -> ScriptExtension
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ScriptExtension
impl Debug for ScriptExtension
source§impl Default for ScriptExtension
impl Default for ScriptExtension
source§impl Display for ScriptExtension
impl Display for ScriptExtension
source§impl From<&str> for ScriptExtension
impl From<&str> for ScriptExtension
source§impl From<Script> for ScriptExtension
impl From<Script> for ScriptExtension
source§impl From<char> for ScriptExtension
impl From<char> for ScriptExtension
source§impl Hash for ScriptExtension
impl Hash for ScriptExtension
source§impl PartialEq for ScriptExtension
impl PartialEq for ScriptExtension
source§fn eq(&self, other: &ScriptExtension) -> bool
fn eq(&self, other: &ScriptExtension) -> bool
self
and other
values to be equal, and is used
by ==
.