pub struct MemoryLayout {
pub blocks: Vec<MemoryBlock>,
pub total_size: usize,
pub base_address: usize,
}Expand description
Memory layout analyzer for defragmentation planning
Fields§
§blocks: Vec<MemoryBlock>All memory blocks in the layout
total_size: usizeTotal memory size
base_address: usizeBase address of the memory region
Implementations§
Source§impl MemoryLayout
impl MemoryLayout
Sourcepub fn new(
blocks: Vec<MemoryBlock>,
total_size: usize,
base_address: usize,
) -> Self
pub fn new( blocks: Vec<MemoryBlock>, total_size: usize, base_address: usize, ) -> Self
Create a new memory layout from a list of blocks
Sourcepub fn sort_blocks(&mut self)
pub fn sort_blocks(&mut self)
Sort blocks by address for easier processing
Sourcepub fn calculate_fragmentation(&self) -> FragmentationInfo
pub fn calculate_fragmentation(&self) -> FragmentationInfo
Calculate fragmentation metrics
Sourcepub fn find_coalescable_blocks(&self) -> Vec<(usize, usize)>
pub fn find_coalescable_blocks(&self) -> Vec<(usize, usize)>
Find coalescable blocks (adjacent free blocks)
Sourcepub fn find_movable_blocks(
&self,
strategy: DefragmentationStrategy,
) -> Vec<usize>
pub fn find_movable_blocks( &self, strategy: DefragmentationStrategy, ) -> Vec<usize>
Find movable blocks for compaction
Sourcepub fn create_compaction_plan(
&self,
strategy: DefragmentationStrategy,
) -> CompactionPlan
pub fn create_compaction_plan( &self, strategy: DefragmentationStrategy, ) -> CompactionPlan
Calculate optimal compaction plan
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryLayout
impl RefUnwindSafe for MemoryLayout
impl Send for MemoryLayout
impl Sync for MemoryLayout
impl Unpin for MemoryLayout
impl UnsafeUnpin for MemoryLayout
impl UnwindSafe for MemoryLayout
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> 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