43 lines
1.1 KiB
Zig
43 lines
1.1 KiB
Zig
const namespace_name = @import("dir_name/file_name.zig");
|
|
const TypeName = @import("dir_name/TypeName.zig");
|
|
var global_var: i32 = undefined;
|
|
const const_name = 42;
|
|
const primitive_type_alias = f32;
|
|
const string_alias = []u8;
|
|
|
|
const StructName = struct {
|
|
field: i32,
|
|
};
|
|
const StructAlias = StructName;
|
|
|
|
fn functionName(param_name: TypeName) void {
|
|
var functionPointer = functionName;
|
|
functionPointer();
|
|
functionPointer = otherFunction;
|
|
functionPointer();
|
|
}
|
|
const functionAlias = functionName;
|
|
|
|
fn ListTemplateFunction(comptime ChildType: type, comptime fixed_size: usize) type {
|
|
return List(ChildType, fixed_size);
|
|
}
|
|
|
|
fn ShortList(comptime T: type, comptime n: usize) type {
|
|
return struct {
|
|
field_name: [n]T,
|
|
fn methodName() void {}
|
|
};
|
|
}
|
|
|
|
// The word XML loses its casing when used in Zig identifiers.
|
|
const xml_document =
|
|
\\<?xml version="1.0" encoding="UTF-8"?>
|
|
\\<document>
|
|
\\</document>
|
|
;
|
|
const XmlParser = struct {
|
|
field: i32,
|
|
};
|
|
|
|
// The initials BE (Big Endian) are just another word in Zig identifier names.
|
|
fn readU32Be() u32 {}
|