[−][src]Struct swim_mem::alloc::AllocTag
Back-pointer to the Hold
that allocated a block. An AllocTag
immediately precedes every memory block allocated by a Hold
.
Methods
impl<'a> AllocTag<'a>
[src]
pub const unsafe fn null() -> AllocTag<'a>
[src]
Returns a new AllocTag
that points to an invalid hold address. Used
as a placeholder when statically initializing fixed memory allocations.
The tag is not safe to use until AllocTag::init
is called with the
base address of a valid Hold
.
Safety
Exposing a null AllocTag
can cause segmentation faults.
pub fn empty() -> AllocTag<'a>
[src]
Returns a new AllocTag
that points to the empty hold.
pub fn new(base: &Reified<dyn Hold<'a>>) -> AllocTag<'a>
[src]
Returns a new AllocTag
that points back to the Hold
that allocated this tag.
pub fn init(&mut self, base: &Reified<dyn Hold<'a>>)
[src]
Initializes this AllocTag
to point to the Hold
at base
. This
operation is idempotent when called repeatedly with the same base
address.
pub fn from_ptr(data: *mut u8) -> *mut AllocTag<'a>
[src]
Returns a pointer to the AllocTag
preceding a data
pointer allocated by a Hold
.
pub fn holder(self: *mut AllocTag<'a>) -> &'a dyn Hold<'a>
[src]
Returns a reference to the Hold
that allocated this tag.
pub unsafe fn dealloc(self: *mut AllocTag<'a>, block: Block<'a>)
[src]
Instructs the Hold
that allocated this tag to deallocate the block
.
pub unsafe fn resize(
self: *mut AllocTag<'a>,
block: Block<'a>,
layout: Layout
) -> Result<Block<'a>, HoldError>
[src]
self: *mut AllocTag<'a>,
block: Block<'a>,
layout: Layout
) -> Result<Block<'a>, HoldError>
Asks the Hold
that allocated this tag to attempt to resize the block
.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,