pub enum DocumentScript {
Latin,
CJK,
RTL,
Complex,
Mixed,
}Expand description
Document script profile for optimization.
OPTIMIZATION (Issue #1 fix): Detect document primary script once, then skip unnecessary script detection functions for faster boundary detection.
When documents contain only Latin text, we skip RTL and CJK detection entirely. When documents are CJK-dominant, we skip RTL detection. This reduces function call overhead from millions per batch to thousands.
Variants§
Latin
Latin-only document (ASCII + extended Latin) Fast path: only check space, TJ offset, geometric gap
CJK
CJK-dominant document (Chinese, Japanese, Korean) Skip RTL detection, use optimized CJK path
RTL
Right-to-left dominant (Arabic, Hebrew) Skip CJK detection, use optimized RTL path
Complex
Complex scripts (Devanagari, Thai, Khmer, etc.) Use specialized complex script detection
Mixed
Mixed scripts or unknown Check all detection functions (slowest path)
Implementations§
Source§impl DocumentScript
impl DocumentScript
Sourcepub fn detect_from_characters(characters: &[CharacterInfo]) -> Self
pub fn detect_from_characters(characters: &[CharacterInfo]) -> Self
Detect document script profile by sampling first 1000 characters.
This optimization reduces boundary detection overhead by skipping unnecessary script detection for documents with known script profiles.
PERFORMANCE: O(min(n, 1000)) sampling, executed once per extraction
Trait Implementations§
Source§impl Clone for DocumentScript
impl Clone for DocumentScript
Source§fn clone(&self) -> DocumentScript
fn clone(&self) -> DocumentScript
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DocumentScript
Source§impl Debug for DocumentScript
impl Debug for DocumentScript
impl Eq for DocumentScript
Source§impl PartialEq for DocumentScript
impl PartialEq for DocumentScript
impl StructuralPartialEq for DocumentScript
Auto Trait Implementations§
impl Freeze for DocumentScript
impl RefUnwindSafe for DocumentScript
impl Send for DocumentScript
impl Sync for DocumentScript
impl Unpin for DocumentScript
impl UnsafeUnpin for DocumentScript
impl UnwindSafe for DocumentScript
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.