pub trait TextureFormatExt {
// Required methods
fn from_storage_format(storage_format: StorageFormat) -> Self;
fn to_storage_format(&self) -> Option<StorageFormat>;
}Expand description
Adds extra conversion functions to TextureFormat.
Required Methods§
Sourcefn from_storage_format(storage_format: StorageFormat) -> Self
fn from_storage_format(storage_format: StorageFormat) -> Self
Finds the TextureFormat corresponding to the given
StorageFormat.
§Examples
use wgpu::util::TextureFormatExt;
assert_eq!(wgpu::TextureFormat::from_storage_format(wgpu::naga::StorageFormat::Bgra8Unorm), wgpu::TextureFormat::Bgra8Unorm);Sourcefn to_storage_format(&self) -> Option<StorageFormat>
fn to_storage_format(&self) -> Option<StorageFormat>
Finds the StorageFormat corresponding to the given TextureFormat.
Returns None if there is no matching storage format,
which typically indicates this format is not supported
for storage textures.
§Examples
use wgpu::util::TextureFormatExt;
assert_eq!(wgpu::TextureFormat::Bgra8Unorm.to_storage_format(), Some(wgpu::naga::StorageFormat::Bgra8Unorm));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.