pub struct MinMaxIndex { /* private fields */ }Expand description
(min, max) pairs of a growing column with O(log n) range queries,
O(log n) push and set_last.
Pairs with a NaN bound are empty (a gap) and never contribute.
§Examples
use ferrochart_core::plugin::MinMaxIndex;
let mut idx = MinMaxIndex::new();
for (lo, hi) in [(1.0, 2.0), (0.5, 3.0), (f64::NAN, f64::NAN), (2.0, 4.0)] {
idx.push(lo, hi)?;
}
assert_eq!(idx.query(0, 2), Some((0.5, 3.0)));
idx.set_last(-1.0, 0.0);
let (lo, hi) = idx.query(0, 4).unwrap();
assert!(lo <= -1.0 && hi >= 3.0);
assert_eq!(idx.query(2, 3), None);Implementations§
Source§impl MinMaxIndex
impl MinMaxIndex
Sourcepub fn heap_bytes(&self) -> usize
pub fn heap_bytes(&self) -> usize
Bytes of heap memory in use.
Sourcepub fn push(&mut self, min: f64, max: f64) -> Result<()>
pub fn push(&mut self, min: f64, max: f64) -> Result<()>
Appends a pair (min, max); NaN in either makes it a gap.
§Errors
Error::OutOfMemory if memory cannot be reserved.
Trait Implementations§
Source§impl Clone for MinMaxIndex
impl Clone for MinMaxIndex
Source§impl Debug for MinMaxIndex
impl Debug for MinMaxIndex
Auto Trait Implementations§
impl Forget for MinMaxIndex
impl Freeze for MinMaxIndex
impl Move for MinMaxIndex
impl RefUnwindSafe for MinMaxIndex
impl Send for MinMaxIndex
impl Sync for MinMaxIndex
impl Unpin for MinMaxIndex
impl UnsafeUnpin for MinMaxIndex
impl UnwindSafe for MinMaxIndex
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