Struct bump_scope::Chunk

source ·
pub struct Chunk<'a, const UP: bool> { /* private fields */ }
Expand description

Refers to a chunk of memory that was allocated by the bump allocator.

See Stats / GuaranteedAllocatedStats.

Implementations§

source§

impl<'a, const UP: bool> Chunk<'a, UP>

source

pub fn prev(self) -> Option<Self>

Returns the previous (smaller) chunk.

source

pub fn next(self) -> Option<Self>

Returns the next (bigger) chunk.

source

pub fn iter_prev(self) -> ChunkPrevIter<'a, UP>

Returns an iterator over all previous (smaller) chunks.

source

pub fn iter_next(self) -> ChunkNextIter<'a, UP>

Returns an iterator over all next (bigger) chunks.

source

pub fn size(self) -> usize

Returns the size of this chunk in bytes.

source

pub fn capacity(self) -> usize

Returns the capacity of this chunk in bytes.

source

pub fn allocated(self) -> usize

Returns the amount of allocated bytes. This includes padding and wasted space due to reallocations.

source

pub fn remaining(self) -> usize

Returns the remaining capacity.

source

pub fn chunk_start(self) -> NonNull<u8>

Returns a pointer to the start of the chunk.

source

pub fn chunk_end(self) -> NonNull<u8>

Returns a pointer to the end of the chunk.

source

pub fn content_start(self) -> NonNull<u8>

Returns a pointer to the start of the chunk’s content.

source

pub fn content_end(self) -> NonNull<u8>

Returns a pointer to the end of the chunk’s content.

source

pub fn bump_position(self) -> NonNull<u8>

Returns the bump pointer. It lies within the chunk’s content range.

Trait Implementations§

source§

impl<'a, const UP: bool> Clone for Chunk<'a, UP>

source§

fn clone(&self) -> Chunk<'a, UP>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const UP: bool> Debug for Chunk<'_, UP>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, const UP: bool> PartialEq for Chunk<'a, UP>

source§

fn eq(&self, other: &Chunk<'a, UP>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, const UP: bool> Copy for Chunk<'a, UP>

source§

impl<'a, const UP: bool> Eq for Chunk<'a, UP>

source§

impl<'a, const UP: bool> StructuralPartialEq for Chunk<'a, UP>

Auto Trait Implementations§

§

impl<'a, const UP: bool> Freeze for Chunk<'a, UP>

§

impl<'a, const UP: bool> !RefUnwindSafe for Chunk<'a, UP>

§

impl<'a, const UP: bool> !Send for Chunk<'a, UP>

§

impl<'a, const UP: bool> !Sync for Chunk<'a, UP>

§

impl<'a, const UP: bool> Unpin for Chunk<'a, UP>

§

impl<'a, const UP: bool> !UnwindSafe for Chunk<'a, UP>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> NoDrop for T
where T: Copy,