Struct vulkano::memory::MappingState
source · pub struct MappingState { /* private fields */ }
Expand description
Represents the currently host-mapped region of a DeviceMemory
block.
Implementations§
source§impl MappingState
impl MappingState
sourcepub fn ptr(&self) -> NonNull<c_void>
pub fn ptr(&self) -> NonNull<c_void>
Returns the pointer to the start of the mapped memory. Meaning that the pointer is already
offset by the offset
.
sourcepub fn offset(&self) -> DeviceSize
pub fn offset(&self) -> DeviceSize
Returns the offset given to DeviceMemory::map
.
sourcepub fn size(&self) -> DeviceSize
pub fn size(&self) -> DeviceSize
Returns the size given to DeviceMemory::map
.
sourcepub fn slice(&self, range: Range<DeviceSize>) -> Option<NonNull<[u8]>>
pub fn slice(&self, range: Range<DeviceSize>) -> Option<NonNull<[u8]>>
Returns a pointer to a slice of the mapped memory. Returns None
if out of bounds.
range
is specified in bytes relative to the start of the memory allocation, and must fall
within the range of the memory mapping given to DeviceMemory::map
.
This function is safe in the sense that the returned pointer is guaranteed to be within bounds of the mapped memory, however dereferencing the pointer isn’t:
- Normal Rust aliasing rules apply: if you create a mutable reference out of the pointer, you must ensure that no other references exist in Rust to any portion of the same memory.
- While a reference created from the pointer exists, there must be no operations pending or executing in any queue on the device, that write to any portion of the same memory.
- While a mutable reference created from the pointer exists, there must be no operations pending or executing in any queue on the device, that read from any portion of the same memory.
Trait Implementations§
source§impl Debug for MappingState
impl Debug for MappingState
impl Send for MappingState
impl Sync for MappingState
Auto Trait Implementations§
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