pub struct AllocatorModel { /* private fields */ }Expand description
Model of the frame allocator for verification
Implementations§
Source§impl AllocatorModel
impl AllocatorModel
Sourcepub fn new(base: u64, count: u64) -> Self
pub fn new(base: u64, count: u64) -> Self
Create a new allocator model with frames in range [base, base + count * FRAME_SIZE)
Sourcepub fn alloc_frame(&mut self) -> Result<u64, AllocModelError>
pub fn alloc_frame(&mut self) -> Result<u64, AllocModelError>
Allocate a single frame, returns the frame address
Sourcepub fn alloc_frame_zone(
&mut self,
zone: MemoryZone,
) -> Result<u64, AllocModelError>
pub fn alloc_frame_zone( &mut self, zone: MemoryZone, ) -> Result<u64, AllocModelError>
Allocate a frame from a specific zone
Sourcepub fn free_frame(&mut self, frame: u64) -> Result<(), AllocModelError>
pub fn free_frame(&mut self, frame: u64) -> Result<(), AllocModelError>
Free a previously allocated frame
Sourcepub fn is_allocated(&self, frame: u64) -> bool
pub fn is_allocated(&self, frame: u64) -> bool
Check if a frame is currently allocated
Sourcepub fn allocated_count(&self) -> usize
pub fn allocated_count(&self) -> usize
Get the number of allocated frames
Sourcepub fn free_count(&self) -> usize
pub fn free_count(&self) -> usize
Get the number of free frames
Trait Implementations§
Source§impl Clone for AllocatorModel
impl Clone for AllocatorModel
Source§fn clone(&self) -> AllocatorModel
fn clone(&self) -> AllocatorModel
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AllocatorModel
impl Debug for AllocatorModel
Source§impl Default for AllocatorModel
impl Default for AllocatorModel
Source§fn default() -> AllocatorModel
fn default() -> AllocatorModel
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AllocatorModel
impl RefUnwindSafe for AllocatorModel
impl Send for AllocatorModel
impl Sync for AllocatorModel
impl Unpin for AllocatorModel
impl UnwindSafe for AllocatorModel
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)