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
size: VectorSize
PartialMatrix
A matrix construction whose component type is inferred from the
argument: mat2x2(1,2,3,4)
.
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>>
impl Constructor<Handle<Type>>
sourcefn borrow_inner(
self,
module: &Module,
) -> Constructor<(Handle<Type>, &TypeInner)>
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.