[−][src]Struct gfx_memory::MappedRange
Represents range of the memory mapped to the host. Provides methods for safer host access to the memory.
Implementations
impl<'a, B: Backend> MappedRange<'a, B>
[src][−]
pub fn ptr(&self) -> NonNull<u8>
[src][−]
Get pointer to beginning of memory region.
i.e. to range().start
offset from memory origin.
pub fn range(&self) -> Range<Size>
[src][−]
Get mapped range.
pub fn is_coherent(&self) -> bool
[src][−]
Return true if the mapped memory is coherent.
pub unsafe fn read<'b, T>(
&'b mut self,
device: &B::Device,
segment: Segment
) -> Result<&'b [T], MapError> where
'a: 'b,
T: Copy,
[src][−]
&'b mut self,
device: &B::Device,
segment: Segment
) -> Result<&'b [T], MapError> where
'a: 'b,
T: Copy,
Fetch readable slice of sub-range to be read. Invalidating range if memory is not coherent.
Safety
- Caller must ensure that device won't write to the memory region until the borrowing ends.
T
Must be plain-old-data type compatible with data in mapped region.
pub unsafe fn write<'b, T: 'b>(
&'b mut self,
device: &'b B::Device,
segment: Segment
) -> Result<Writer<'a, 'b, T, B>, MapError> where
'a: 'b,
T: Copy,
[src][−]
&'b mut self,
device: &'b B::Device,
segment: Segment
) -> Result<Writer<'a, 'b, T, B>, MapError> where
'a: 'b,
T: Copy,
Fetch writer to the sub-region. This writer will flush data on drop if written at least once.
Safety
- Caller must ensure that device won't write to or read from the memory region.
Trait Implementations
Auto Trait Implementations
impl<'a, B> RefUnwindSafe for MappedRange<'a, B> where
<B as Backend>::Memory: RefUnwindSafe,
<B as Backend>::Memory: RefUnwindSafe,
impl<'a, B> !Send for MappedRange<'a, B>
impl<'a, B> !Sync for MappedRange<'a, B>
impl<'a, B> Unpin for MappedRange<'a, B>
impl<'a, B> UnwindSafe for MappedRange<'a, B> where
<B as Backend>::Memory: RefUnwindSafe,
<B as Backend>::Memory: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,