pub struct ModeWeightStatistics { /* private fields */ }Expand description
Mode-weighted font statistics for heading/paragraph classification.
Implementations§
Source§impl ModeWeightStatistics
impl ModeWeightStatistics
Sourcepub fn add(&mut self, font_size: f64, char_count: usize)
pub fn add(&mut self, font_size: f64, char_count: usize)
Add a font size observation with the given character count.
Sourcepub fn mode_font_size(&self) -> Option<f64>
pub fn mode_font_size(&self) -> Option<f64>
Get the mode (most frequent) font size.
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Total character count.
Sourcepub fn is_larger_than_mode(&self, font_size: f64) -> bool
pub fn is_larger_than_mode(&self, font_size: f64) -> bool
Whether a font size is larger than the mode (potential heading).
Sourcepub fn is_mode_size(&self, font_size: f64) -> bool
pub fn is_mode_size(&self, font_size: f64) -> bool
Whether a font size matches the mode (body text).
Trait Implementations§
Source§impl Clone for ModeWeightStatistics
impl Clone for ModeWeightStatistics
Source§fn clone(&self) -> ModeWeightStatistics
fn clone(&self) -> ModeWeightStatistics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModeWeightStatistics
impl Debug for ModeWeightStatistics
Source§impl Default for ModeWeightStatistics
impl Default for ModeWeightStatistics
Source§fn default() -> ModeWeightStatistics
fn default() -> ModeWeightStatistics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModeWeightStatistics
impl RefUnwindSafe for ModeWeightStatistics
impl Send for ModeWeightStatistics
impl Sync for ModeWeightStatistics
impl Unpin for ModeWeightStatistics
impl UnsafeUnpin for ModeWeightStatistics
impl UnwindSafe for ModeWeightStatistics
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more