pub struct RangeMap<T> {
v: Vec<Elem<T>>,
}
Fields§
§v: Vec<Elem<T>>
Implementations§
source§impl<T> RangeMap<T>
impl<T> RangeMap<T>
sourcepub fn new(size: Size, init: T) -> RangeMap<T>
pub fn new(size: Size, init: T) -> RangeMap<T>
Creates a new RangeMap
for the given size, and with the given initial value used for
the entire range.
sourcefn find_offset(&self, offset: u64) -> usize
fn find_offset(&self, offset: u64) -> usize
Finds the index containing the given offset.
sourcepub fn iter(
&self,
offset: Size,
len: Size
) -> impl Iterator<Item = (Range<u64>, &T)>
pub fn iter( &self, offset: Size, len: Size ) -> impl Iterator<Item = (Range<u64>, &T)>
Provides read-only iteration over everything in the given range. This does not split items if they overlap with the edges. Do not use this to mutate through interior mutability.
The iterator also provides the range of the given element. How exactly the ranges are split can differ even for otherwise identical maps, so user-visible behavior should never depend on the exact range.
sourcepub fn iter_mut_all(&mut self) -> impl Iterator<Item = (Range<u64>, &mut T)>
pub fn iter_mut_all(&mut self) -> impl Iterator<Item = (Range<u64>, &mut T)>
Provides mutable iteration over all elements. The iterator also provides the range of the given element. How exactly the ranges are split can differ even for otherwise identical maps, so user-visible behavior should never depend on the exact range.
sourcepub fn iter_all(&self) -> impl Iterator<Item = (Range<u64>, &T)>
pub fn iter_all(&self) -> impl Iterator<Item = (Range<u64>, &T)>
Provides iteration over all elements. The iterator also provides the range of the given element. How exactly the ranges are split can differ even for otherwise identical maps, so user-visible behavior should never depend on the exact range.
fn split_index(&mut self, index: usize, split_offset: u64) -> boolwhere T: Clone,
sourcepub fn iter_mut(
&mut self,
offset: Size,
len: Size
) -> impl Iterator<Item = (Range<u64>, &mut T)>where
T: Clone + PartialEq,
pub fn iter_mut( &mut self, offset: Size, len: Size ) -> impl Iterator<Item = (Range<u64>, &mut T)>where T: Clone + PartialEq,
Provides mutable iteration over everything in the given range. As a side-effect, this will split entries in the map that are only partially hit by the given range, to make sure that when they are mutated, the effect is constrained to the given range. Moreover, this will opportunistically merge neighbouring equal blocks.
The iterator also provides the range of the given element. How exactly the ranges are split (both prior to and resulting from the execution of this function) can differ even for otherwise identical maps, so user-visible behavior should never depend on the exact range.
sourcepub fn merge_adjacent_thorough(&mut self)where
T: PartialEq,
pub fn merge_adjacent_thorough(&mut self)where T: PartialEq,
Remove all adjacent duplicates
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for RangeMap<T>where T: RefUnwindSafe,
impl<T> Send for RangeMap<T>where T: Send,
impl<T> Sync for RangeMap<T>where T: Sync,
impl<T> Unpin for RangeMap<T>where T: Unpin,
impl<T> UnwindSafe for RangeMap<T>where T: 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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes