structT()
함수, 타입 분류
Builds the ShaderType for a named struct: the type you pass wherever a struct-typed value is authored (a b.var(name, structT('VsOut')) local, an fn parameter, an array element via arrayT).
import { structT } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
const structT: <N extends string>( name: N,) => { readonly kind: "struct"; readonly name: N; }매개변수
nameN extends stringThe struct’s declared name; it becomes the type’s key,
struct:<name>.
반환값
{ readonly kind: 'struct'; readonly name: N }
A { kind: 'struct', name } descriptor whose name keeps its literal type.
설명
Two calls with the same name compare equal under typeKey and
typeEq regardless of identity, since the key is the name string alone; the field
list is never compared here. Prefer the higher-level ioStruct and
uniformStruct declarators for new code, which return a typed accessor built on top
of this; call structT directly when you already have a StructDecl and need its
bare ShaderType.
예제
예제
import { structT, typeEq } from 'typeshade'
// Equality is by name only.typeEq(structT('DF64Vec2'), structT('DF64Vec2')) // true함께 보기
소스
src/core/ir/types.ts, 794행, 커밋 c66579bf 기준