Skip to main content

FreeOnlyAllocator

Struct FreeOnlyAllocator 

Source
pub struct FreeOnlyAllocator { /* private fields */ }

Implementations§

Source§

impl FreeOnlyAllocator

Source

pub fn join(file: &File) -> Result<Self, Error>

Join an existing allocator in the provided file.

§Note

Prefer Self::join_from_existing to re-use mmaps within the same process.

Source

pub fn join_from_existing(existing: &Allocator) -> Self

Join an existing allocator using the same in-process mapping.

Source

pub fn join_from_existing_free_only(existing: &FreeOnlyAllocator) -> Self

Join an existing free-only allocator using the same in-process mapping.

Source§

impl FreeOnlyAllocator

Source

pub unsafe fn free(&self, ptr: NonNull<u8>)

Free a block of memory previously allocated by this allocator.

§Safety
  • The ptr must be a valid pointer to a block of memory allocated by this allocator.
  • The ptr must not have been freed before.
Source

pub unsafe fn free_offset(&self, offset: usize)

Free a block of memory previously allocated by this allocator.

§Safety
  • The offset must be a valid offset within the memory allocated by this allocator.
  • The offset must not have been freed before.
Source

pub unsafe fn offset(&self, ptr: NonNull<u8>) -> usize

Find the offset given a pointer.

§Safety
  • The ptr must be a valid pointer in the allocator’s address space.
Source

pub unsafe fn ptr_from_offset(&self, offset: usize) -> NonNull<u8>

Return a ptr given a shareable offset - calculated by offset.

§Safety
  • Caller must ensure the offset is valid for this allocator.

Trait Implementations§

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.