blob: 22bc7a894e8c10830a654969b12fbc3885c696e2 (
plain) (
tree)
|
|
// File name starting with capital letters indicate a type definition.
// Alias for this type.
const Self = @This();
// Struct fields.
id: i32,
op: u32 = 42,
// Public static method, creating an Object.
pub fn init(v: i32) Self {
return Self{ .id = v };
}
// Public member function.
pub fn dump(self: Self) void {
const print = @import("std").debug.print;
print("Self = {s}\n", .{@typeName(Self)});
print("ID = {} OP = {}\n", .{ self.id, self.op });
}
|