#[non_exhaustive]pub enum DataAccess {
HostReadable,
MappableToHost,
Opaque,
}Expand description
What host-access is available for a frame’s pixel data.
This is the finer-grained companion to Residency. Where
Residency says where the data lives, DataAccess says
how a CPU consumer can (or cannot) obtain host bytes.
Retrieve via FrameEnvelope::data_access().
§Canonical usage
ⓘ
match frame.data_access() {
DataAccess::HostReadable => {
let bytes = frame.host_data().unwrap();
}
DataAccess::MappableToHost => {
let pixels = frame.require_host_data()?;
}
DataAccess::Opaque => {
let handle = frame.accelerated_handle::<MyAccelBuf>();
}
_ => { /* forward-compatible: handle additional access classes */ }
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
HostReadable
Host-readable bytes are directly available (zero-copy borrow).
MappableToHost
Device-resident, but host materialization is available.
The first call to FrameEnvelope::require_host_data() invokes
the backend materializer and caches the result in the frame’s
Arc-shared inner state. Subsequent calls return a zero-copy
borrow of the cached bytes.
Opaque
Opaque accelerated data; no host view is guaranteed.
FrameEnvelope::require_host_data() returns
FrameAccessError::NotHostAccessible.
Trait Implementations§
Source§impl Clone for DataAccess
impl Clone for DataAccess
Source§fn clone(&self) -> DataAccess
fn clone(&self) -> DataAccess
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DataAccess
impl Debug for DataAccess
Source§impl Hash for DataAccess
impl Hash for DataAccess
Source§impl PartialEq for DataAccess
impl PartialEq for DataAccess
impl Copy for DataAccess
impl Eq for DataAccess
impl StructuralPartialEq for DataAccess
Auto Trait Implementations§
impl Freeze for DataAccess
impl RefUnwindSafe for DataAccess
impl Send for DataAccess
impl Sync for DataAccess
impl Unpin for DataAccess
impl UnsafeUnpin for DataAccess
impl UnwindSafe for DataAccess
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