Enum naga::front::wgsl::lower::construction::Constructor

source ·
enum Constructor<T> {
    PartialVector {
        size: VectorSize,
    },
    PartialMatrix {
        columns: VectorSize,
        rows: VectorSize,
    },
    PartialArray,
    Type(T),
}
Expand description

A cooked form of ast::ConstructorType that uses Naga types whenever possible.

Variants§

§

PartialVector

A vector construction whose component type is inferred from the argument: vec3(1.0).

Fields

§

PartialMatrix

A matrix construction whose component type is inferred from the argument: mat2x2(1,2,3,4).

Fields

§columns: VectorSize
§

PartialArray

An array whose component type and size are inferred from the arguments: array(3,4,5).

§

Type(T)

A known Naga type.

When we match on this type, we need to see the TypeInner here, but at the point that we build this value we’ll still need mutable access to the module later. To avoid borrowing from the module, the type parameter T is Handle<Type> initially. Then we use borrow_inner to produce a version holding a tuple (Handle<Type>, &TypeInner).

Implementations§

source§

impl Constructor<Handle<Type>>

source

fn borrow_inner( self, module: &Module, ) -> Constructor<(Handle<Type>, &TypeInner)>

Return an equivalent Constructor value that includes borrowed TypeInner values alongside any type handles.

The returned form is more convenient to match on, since the patterns can actually see what the handle refers to.

source§

impl Constructor<(Handle<Type>, &TypeInner)>

source

fn to_error_string(&self, ctx: &ExpressionContext<'_, '_, '_>) -> String

Auto Trait Implementations§

§

impl<T> Freeze for Constructor<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Constructor<T>
where T: RefUnwindSafe,

§

impl<T> Send for Constructor<T>
where T: Send,

§

impl<T> Sync for Constructor<T>
where T: Sync,

§

impl<T> Unpin for Constructor<T>
where T: Unpin,

§

impl<T> UnwindSafe for Constructor<T>
where T: UnwindSafe,

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.