pub struct RangeMap { /* private fields */ }Expand description
An index structure that maps memory addresses to allocation indices.
Built once from a list of allocations, then queried many times during pointer scanning.
Implementations§
Source§impl RangeMap
impl RangeMap
Sourcepub fn new(allocations: &[ActiveAllocation]) -> Self
pub fn new(allocations: &[ActiveAllocation]) -> Self
Build a RangeMap from a list of active allocations.
§Arguments
allocations- Slice of allocations to index. Each allocation’s index in this slice becomes itsalloc_id.
Sourcepub fn find_containing(&self, ptr: usize) -> Option<usize>
pub fn find_containing(&self, ptr: usize) -> Option<usize>
Find the allocation ID that contains the given pointer.
Returns Some(alloc_id) if ptr falls within [start, end) of
some allocation, or None if no allocation contains it.
§Complexity
O(log n) via binary search.
Sourcepub fn find_exact_start(&self, ptr: usize) -> Option<usize>
pub fn find_exact_start(&self, ptr: usize) -> Option<usize>
Find the allocation ID where the pointer equals the start address.
Returns Some(alloc_id) if ptr == alloc.start for some allocation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RangeMap
impl RefUnwindSafe for RangeMap
impl Send for RangeMap
impl Sync for RangeMap
impl Unpin for RangeMap
impl UnsafeUnpin for RangeMap
impl UnwindSafe for RangeMap
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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