pub struct Heap<T> { /* private fields */ }Expand description
The inspect heap.
Implementations§
Source§impl<T: ReadBytes + WriteBytes> Heap<T>
impl<T: ReadBytes + WriteBytes> Heap<T>
Sourcepub fn new(container: T) -> Result<Self, Error>
pub fn new(container: T) -> Result<Self, Error>
Creates a new heap on the underlying mapped VMO and initializes the header block in it.
Sourcepub fn empty(container: T) -> Result<Self, Error>
pub fn empty(container: T) -> Result<Self, Error>
Creates a new heap on the underlying mapped VMO without initializing the header block.
Sourcepub fn current_size(&self) -> usize
pub fn current_size(&self) -> usize
Returns the current size of this heap in bytes.
Sourcepub fn maximum_size(&self) -> usize
pub fn maximum_size(&self) -> usize
Returns the maximum size of this heap in bytes.
Sourcepub fn total_allocated_blocks(&self) -> usize
pub fn total_allocated_blocks(&self) -> usize
Returns the number of blocks allocated since the creation of this heap.
Sourcepub fn total_deallocated_blocks(&self) -> usize
pub fn total_deallocated_blocks(&self) -> usize
Returns the number blocks deallocated since the creation of this heap.
Sourcepub fn failed_allocations(&self) -> usize
pub fn failed_allocations(&self) -> usize
Returns the number of failed allocations since the creation of this heap.
Sourcepub fn allocate_block(&mut self, min_size: usize) -> Result<BlockIndex, Error>
pub fn allocate_block(&mut self, min_size: usize) -> Result<BlockIndex, Error>
Allocates a new block of the given min_size.
Sourcepub fn free_block(&mut self, block_index: BlockIndex) -> Result<(), Error>
pub fn free_block(&mut self, block_index: BlockIndex) -> Result<(), Error>
Marks the memory region pointed by the given block as free.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Heap<T>where
T: Freeze,
impl<T> RefUnwindSafe for Heap<T>where
T: RefUnwindSafe,
impl<T> Send for Heap<T>where
T: Send,
impl<T> Sync for Heap<T>where
T: Sync,
impl<T> Unpin for Heap<T>where
T: Unpin,
impl<T> UnsafeUnpin for Heap<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Heap<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
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
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