pub struct Chunk<'a, A, const UP: bool> { /* private fields */ }
Expand description
Refers to a chunk of memory that was allocated by the bump allocator.
See Stats
.
Implementations§
Source§impl<'a, A, const UP: bool> Chunk<'a, A, UP>
impl<'a, A, const UP: bool> Chunk<'a, A, UP>
Sourcepub fn iter_prev(self) -> ChunkPrevIter<'a, A, UP> ⓘ
pub fn iter_prev(self) -> ChunkPrevIter<'a, A, UP> ⓘ
Returns an iterator over all previous (smaller) chunks.
Sourcepub fn iter_next(self) -> ChunkNextIter<'a, A, UP> ⓘ
pub fn iter_next(self) -> ChunkNextIter<'a, A, UP> ⓘ
Returns an iterator over all next (bigger) chunks.
Sourcepub fn allocated(self) -> usize
pub fn allocated(self) -> usize
Returns the amount of allocated bytes. This includes padding and wasted space due to reallocations.
This property can be misleading for chunks that come after the current chunk because
their bump_position
and consequently the allocated
property is not reset until
they become the current chunk again.
Sourcepub fn remaining(self) -> usize
pub fn remaining(self) -> usize
Returns the remaining capacity.
This property can be misleading for chunks that come after the current chunk because
their bump_position
and consequently the remaining
property is not reset until
they become the current chunk again.
Sourcepub fn chunk_start(self) -> NonNull<u8>
pub fn chunk_start(self) -> NonNull<u8>
Returns a pointer to the start of the chunk.
Sourcepub fn content_start(self) -> NonNull<u8>
pub fn content_start(self) -> NonNull<u8>
Returns a pointer to the start of the chunk’s content.
Sourcepub fn content_end(self) -> NonNull<u8>
pub fn content_end(self) -> NonNull<u8>
Returns a pointer to the end of the chunk’s content.
Sourcepub fn bump_position(self) -> NonNull<u8>
pub fn bump_position(self) -> NonNull<u8>
Returns the bump pointer. It lies within the chunk’s content range.
This property can be misleading for chunks that come after the current chunk because
their bump_position
is not reset until they become the current chunk again.