pub struct Chunk {
previous: Option<NonNull<Chunk>>,
cursor: *mut u8,
chunk_end: *mut u8,
size: usize,
}
Expand description
A Contiguous buffer of memory holding multiple sub-allocaions.
Fields§
§previous: Option<NonNull<Chunk>>
§cursor: *mut u8
Offset of the next allocation
chunk_end: *mut u8
Points to the first byte after the chunk’s buffer.
size: usize
Size of the chunk
Implementations§
Source§impl Chunk
impl Chunk
pub fn allocate_item( this: NonNull<Chunk>, layout: Layout, ) -> Result<NonNull<[u8]>, ()>
pub unsafe fn deallocate_item( this: NonNull<Chunk>, item: NonNull<u8>, layout: Layout, )
pub unsafe fn grow_item( this: NonNull<Chunk>, item: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> Result<NonNull<[u8]>, ()>
pub unsafe fn shrink_item( this: NonNull<Chunk>, item: NonNull<u8>, old_layout: Layout, new_layout: Layout, ) -> NonNull<[u8]>
pub fn contains_item(this: NonNull<Chunk>, item: NonNull<u8>) -> bool
fn available_size(this: NonNull<Chunk>) -> usize
fn utilization(this: NonNull<Chunk>) -> f32
Auto Trait Implementations§
impl Freeze for Chunk
impl RefUnwindSafe for Chunk
impl !Send for Chunk
impl !Sync for Chunk
impl Unpin for Chunk
impl UnwindSafe for Chunk
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