pub trait BufferWrapper: Into<Buffer> {
const DEFAULT_USAGES: BufferUsages = _;
// Required method
fn buffer(&self) -> &Buffer;
// Provided methods
fn download<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
device: &'life1 Device,
queue: &'life2 Queue,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>
where Self: Send + Sync + 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn prepare_download(
&self,
device: &Device,
encoder: &mut CommandEncoder,
) -> Buffer { ... }
fn map_download<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>
where T: 'async_trait + NoUninit + AnyBitPattern,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn map_download_with_poll_type<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
poll_type: PollType,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>
where T: 'async_trait + NoUninit + AnyBitPattern,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
A trait to enable any wrapper to act like a wgpu::Buffer.
This trait provides methods to download the buffer data asynchronously. However, if you want to
override the async methods, you should use the [async_trait] crate to implement the trait.
Provided Associated Constants§
Sourceconst DEFAULT_USAGES: BufferUsages = _
const DEFAULT_USAGES: BufferUsages = _
The default usages.
Required Methods§
Provided Methods§
Sourcefn download<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
device: &'life1 Device,
queue: &'life2 Queue,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
Self: Send + Sync + 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn download<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
device: &'life1 Device,
queue: &'life2 Queue,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
Self: Send + Sync + 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Download the buffer data into a Vec.
Sourcefn prepare_download(
&self,
device: &Device,
encoder: &mut CommandEncoder,
) -> Buffer
fn prepare_download( &self, device: &Device, encoder: &mut CommandEncoder, ) -> Buffer
Prepare for downloading the buffer data.
Returns the download buffer (with wgpu::BufferUsages::COPY_DST and
wgpu::BufferUsages::MAP_READ) holding the selection buffer data.
Sourcefn map_download<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
T: 'async_trait + NoUninit + AnyBitPattern,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn map_download<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
T: 'async_trait + NoUninit + AnyBitPattern,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Map the download buffer to read the buffer data.
download should be created with wgpu::BufferUsages::MAP_READ.
This uses wgpu::PollType::wait_indefinitely to wait for the mapping to complete,
you can specify a custom poll type with BufferWrapper::map_download_with_poll_type.
Sourcefn map_download_with_poll_type<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
poll_type: PollType,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
T: 'async_trait + NoUninit + AnyBitPattern,
'life0: 'async_trait,
'life1: 'async_trait,
fn map_download_with_poll_type<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
poll_type: PollType,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
T: 'async_trait + NoUninit + AnyBitPattern,
'life0: 'async_trait,
'life1: 'async_trait,
Map the download buffer to read the buffer data with custom wgpu::PollType.
download should be created with wgpu::BufferUsages::MAP_READ.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.