Enum Type

Source
#[non_exhaustive]
pub enum Type {
Show 17 variants Unknown, Void, Bool, Int32, UInt32, Float32, Vec2, Vec3, Vec4, Mat3, Mat4, Image2D { depth: bool, sampled: bool, format: u32, }, Sampler, SampledImage { image_type_id: u32, }, Array { element_type_id: u32, length: Option<u32>, }, Struct { name: Option<String>, elements: Vec<StructMember>, }, Pointer { storage_class: StorageClass, pointed_type_id: u32, },
}
Expand description

Represents a type declared in a SPIRV module.

Types are declared in a hierarchy, with e.g. pointers relying on previously declared types as pointed-to types.

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.
§

Unknown

An unsupported type

§

Void

The Void type

§

Bool

A boolean

§

Int32

A signed 32-Bit integer

§

UInt32

An unsigned 32-Bit integer

§

Float32

A 32-Bit float

§

Vec2

A 2 component, 32-Bit vector (GLSL: vec2)

§

Vec3

A 3 component, 32-Bit vector (GLSL: vec3)

§

Vec4

A 4 component, 32-Bit vector (GLSL: vec4)

§

Mat3

A 3x3, 32-Bit Matrix (GLSL: mat3)

§

Mat4

A 4x4, 32-Bit Matrix (GLSL: mat4)

§

Image2D

A 2D image

Fields

§depth: bool

true if this image is a depth image

§sampled: bool

true if this image can be sampled from

§format: u32

SPIRV code of the images format (should always be 0 in Vulkan)

§

Sampler

An opaque sampler object

§

SampledImage

A combined image and sampler (Vulkan: CombinedImageSampler descriptor)

Fields

§image_type_id: u32

type id of the image contained in the SampledImage

§

Array

Either a static array with known length (length is Some) or dynamic array with unknown length (length is None)

Fields

§element_type_id: u32

type id of the contained type

§length: Option<u32>

length of the array (if known)

§

Struct

A struct containing other types

Fields

§elements: Vec<StructMember>

members of the struct, in the order they appear in the SPIRV module (not necessarily ascending offsets)

§

Pointer

A pointer pointing to another type

Fields

§storage_class: StorageClass

The type of storage this pointer points to

§pointed_type_id: u32

The type id of the pointed-to type

Trait Implementations§

Source§

impl Debug for Type

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.