#[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: boolImplementations§
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 more