---
title: "StructLayout: interface in Reflection, TypeShade API"
description: "StructLayout, an interface in Reflection. A struct's complete byte layout: its total size and align plus one FieldLayout per field, in declaration order."
url: https://typeshade.dev/api/structlayout/
language: en
---

# `StructLayout`

Interface in Reflection

A struct's complete byte layout: its total size and align plus one FieldLayout per field, in declaration order.

`import type { StructLayout } from 'typeshade'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
interface StructLayout {
  readonly name: string;
  readonly emitted: string;
  readonly size: number;
  readonly align: number;
  readonly fields: readonly FieldLayout[];
}
```

## Description

[`wgslLayout`](https://typeshade.dev/api/wgsllayout/) produces one for a standalone struct; [`reflect`](https://typeshade.dev/api/reflect/) produces one for every struct bound in a module, under std140 for a `uniform` binding and std430 for a `storage` binding (see [`LayoutKind`](https://typeshade.dev/api/layoutkind/)). `size` is already rounded up to `align`, which under std140 is itself rounded to 16, so it is also the element stride of an array of this struct.

## Instance properties

**`name` read only `string`**

The struct’s authored name, the one the host reads by.

**`emitted` read only `string`**

The struct’s name in the emitted text ([Rule 11.10](https://typeshade.dev/reference/rules/11-10/)).

**`size` read only `number`**

**`align` read only `number`**

**`fields` read only `readonly FieldLayout[]`**

## See also

- [`FieldLayout`](https://typeshade.dev/api/fieldlayout/)
- [`wgslLayout`](https://typeshade.dev/api/wgsllayout/)
- [`reflect`](https://typeshade.dev/api/reflect/)
- [`LayoutKind`](https://typeshade.dev/api/layoutkind/)

## Source

[`src/core/reflect/layout.ts`, line 173](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/reflect/layout.ts#L173), at commit af54ddad5
