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
impl Heights
pub fn fixed(len: usize, height: f64) -> Result<Self, Error>
pub fn variable(len: usize, estimate: f64) -> Result<Self, Error>
Sourcepub fn sparse(len: usize, estimate: f64) -> Result<Self, Error>
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.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn storage_len(&self) -> usize
Sourcepub fn storage_capacity(&self) -> usize
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.
pub fn height(&self, index: usize) -> Option<f64>
Sourcepub fn prefix(&self, count: usize) -> Result<f64, Error>
pub fn prefix(&self, count: usize) -> Result<f64, Error>
Offset of the boundary preceding count, with count==len at the end.
pub fn total(&self) -> f64
Trait Implementations§
Auto Trait Implementations§
impl Forget for Heights
impl Freeze for Heightswhere
*const u8 is !null: Freeze,
PhantomData<f64>: Freeze,
PhantomData<(usize, f64)>: Freeze,
PhantomData<(usize, Deviation)>: Freeze,
impl Move for Heights
impl RefUnwindSafe for Heights
impl Send for Heights
impl Sync for Heights
impl Unpin for Heights
impl UnsafeUnpin for Heightswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<f64>: UnsafeUnpin,
PhantomData<(usize, f64)>: UnsafeUnpin,
PhantomData<(usize, Deviation)>: UnsafeUnpin,
impl UnwindSafe for Heightswhere
RawVecInner: UnwindSafe,
HashMap<usize, f64>: UnwindSafe,
HashMap<usize, Deviation>: UnwindSafe,
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