This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.

Types

~import std/types

Koru Standard Library: Type Declarations

types.kz · 10 tors · ~[comptime]· ~[runtime]

Koru Standard Library: Type Declarations · 28 more lines
Koru Standard Library: Type Declarations This module provides events for declaring Zig types that Koru can reason about. All events use explicit module paths (no keywords) to keep things clear. Koru doesn't have a built-in type system - Zig does all the type checking. But by declaring types through these events, Koru can: - Track types in a registry for transforms - Apply layout annotations like [soa], [packed] - Enable data-oriented patterns (ECS, etc.) USAGE: import std/types std/types:struct(Player) { name: []const u8, health: i32 } [pub]std/types:struct(Position) { x: f32, y: f32 } std/types:enum(Color) { red, green, blue } [pub]std/types:enum(State) { idle, running, jumping } std/types:union(Value) { int: i32, float: f32, none } Future annotations: [pub|soa]std/types:struct(Enemies) { hp: i32, x: f32, y: f32 } [packed]std/types:struct(NetworkPacket) { ... } NOTE: For const declarations, use raw Zig or const (in std/declarations — const is a value declaration, not a type, so it lives in its own module).

fields-of

comptime koru_std/types.kz:49

struct

keywordcomptimetransform koru_std/types.kz:66

struct.impl

norun koru_std/types.kz:74

enum

comptimenorun koru_std/types.kz:209

union

comptimenorun koru_std/types.kz:216

string

keywordcomptimetransform koru_std/types.kz:236

int

keywordcomptimetransform koru_std/types.kz:287

float

keywordcomptimetransform koru_std/types.kz:336

bool

keywordcomptimetransform koru_std/types.kz:385

type

keywordcomptimetransform koru_std/types.kz:445