Skip to main content

Heights

Struct Heights 

Source
pub struct Heights { /* private fields */ }
Expand description

Fixed heights allocate no per-item storage. Variable heights use a Fenwick tree: one measurement or a prefix/offset lookup costs O(log n), not O(n).

Implementations§

Source§

impl Heights

Source

pub fn fixed(len: usize, height: f64) -> Result<Self, Error>

Source

pub fn variable(len: usize, estimate: f64) -> Result<Self, Error>

Source

pub fn sparse(len: usize, estimate: f64) -> Result<Self, Error>

Uniform estimates need no per-item allocation. Only measured deviations and their Fenwick ancestors are stored. A widget can bound retained measurements by resetting old ones to estimate with measure.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn storage_len(&self) -> usize

Source

pub fn storage_capacity(&self) -> usize

Reserved entries, for detecting retained allocation after long scrolling. HashMap capacities are entry counts, not byte or bucket-size estimates.

Source

pub fn height(&self, index: usize) -> Option<f64>

Source

pub fn prefix(&self, count: usize) -> Result<f64, Error>

Offset of the boundary preceding count, with count==len at the end.

Source

pub fn total(&self) -> f64

Source

pub fn measure(&mut self, index: usize, height: f64) -> Result<bool, Error>

Zero-height entries must be filtered from the source rather than creating an unbounded number of “visible” rows. Measurements must be positive.

Source

pub fn splice( &mut self, range: Range<usize>, inserted: usize, estimate: f64, ) -> Result<(), Error>

Explicit data edits, never called for a scroll. Fixed-size edits are O(1); variable-size edits rebuild O(n), preserving unaffected measures.

Trait Implementations§

Source§

impl Debug for Heights

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Heights

§

impl Freeze for Heights

§

impl Move for Heights

§

impl RefUnwindSafe for Heights

§

impl Send for Heights
where RawVecInner: Send, RawTable<(usize, f64)>: Send, RawTable<(usize, Deviation)>: Send,

§

impl Sync for Heights
where RawVecInner: Sync, RawTable<(usize, f64)>: Sync, RawTable<(usize, Deviation)>: Sync,

§

impl Unpin for Heights
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Heights

§

impl UnwindSafe for Heights
where RawVecInner: UnwindSafe, HashMap<usize, f64>: UnwindSafe, HashMap<usize, Deviation>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.