Struct Allocation

Source
pub struct Allocation<LT: Lifetime> { /* private fields */ }
Expand description

An allocation of the Allocator.

Implementations§

Source§

impl<LT: Lifetime> Allocation<LT>

Source

pub fn device_memory(&self) -> DeviceMemory

The DeviceMemory of the allocation. Managed by the allocator.

Source

pub fn offset(&self) -> DeviceSize

The offset inside the DeviceMemory.

Source

pub fn size(&self) -> DeviceSize

The size of the allocation.

Source

pub unsafe fn mapped_slice(&self) -> Result<Option<&[u8]>, AllocatorError>

Returns a valid mapped slice if the memory is host visible, otherwise it will return None. The slice already references the exact memory region of the sub allocation, so no offset needs to be applied.

§Safety

Caller needs to make sure that the allocation is still valid and coherent.

Source

pub unsafe fn mapped_slice_mut( &mut self, ) -> Result<Option<&mut [u8]>, AllocatorError>

Returns a valid mapped mutable slice if the memory is host visible, otherwise it will return None. The slice already references the exact memory region of the sub allocation, so no offset needs to be applied.

§Safety

Caller needs to make sure that the allocation is still valid and coherent.

Trait Implementations§

Source§

impl<LT: Clone + Lifetime> Clone for Allocation<LT>

Source§

fn clone(&self) -> Allocation<LT>

Returns a duplicate 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<LT: Debug + Lifetime> Debug for Allocation<LT>

Source§

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

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

impl<LT: Lifetime> Send for Allocation<LT>

Source§

impl<LT: Lifetime> Sync for Allocation<LT>

Auto Trait Implementations§

§

impl<LT> Freeze for Allocation<LT>
where LT: Freeze,

§

impl<LT> RefUnwindSafe for Allocation<LT>
where LT: RefUnwindSafe,

§

impl<LT> Unpin for Allocation<LT>
where LT: Unpin,

§

impl<LT> UnwindSafe for Allocation<LT>
where LT: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

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.