Skip to content

Commit a604fd6

Browse files
bchaliosShadowCurse
authored andcommitted
address_allocator: add methods to get base and size
Add methods that allow to get info about the base address and size of the region that an AddressAllocator is handling. Signed-off-by: Babis Chalios <bchalios@amazon.es>
1 parent 2772fa9 commit a604fd6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/address_allocator.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ impl AddressAllocator {
7272
pub fn free(&mut self, key: &RangeInclusive) -> Result<()> {
7373
self.interval_tree.free(key)
7474
}
75+
76+
/// First address of the allocator.
77+
pub fn base(&self) -> u64 {
78+
self.address_space.start()
79+
}
80+
81+
/// Last address of the allocator.
82+
pub fn end(&self) -> u64 {
83+
self.address_space.end()
84+
}
7585
}
7686

7787
#[cfg(test)]

0 commit comments

Comments
 (0)