mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
zig fmt :|
This commit is contained in:
@@ -40,17 +40,19 @@ pub const MyObject = struct {
|
|||||||
val: bool,
|
val: bool,
|
||||||
|
|
||||||
pub fn constructor(do_set: bool) MyObject {
|
pub fn constructor(do_set: bool) MyObject {
|
||||||
return .{.val = do_set,};
|
return .{
|
||||||
|
.val = do_set,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion {
|
pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion {
|
||||||
if (std.mem.eql(u8, name, "a")) {
|
if (std.mem.eql(u8, name, "a")) {
|
||||||
has_value.* = true;
|
has_value.* = true;
|
||||||
return .{.Other = .{.val = 4}};
|
return .{ .Other = .{ .val = 4 } };
|
||||||
}
|
}
|
||||||
if (std.mem.eql(u8, name, "c")) {
|
if (std.mem.eql(u8, name, "c")) {
|
||||||
has_value.* = true;
|
has_value.* = true;
|
||||||
return .{.Bool = true};
|
return .{ .Bool = true };
|
||||||
}
|
}
|
||||||
has_value.* = false;
|
has_value.* = false;
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -408,15 +408,12 @@ pub const TrackingAllocator = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn allocator(self: *TrackingAllocator) Allocator {
|
pub fn allocator(self: *TrackingAllocator) Allocator {
|
||||||
return .{
|
return .{ .ptr = self, .vtable = &.{
|
||||||
.ptr = self,
|
|
||||||
.vtable = &.{
|
|
||||||
.alloc = alloc,
|
.alloc = alloc,
|
||||||
.resize = resize,
|
.resize = resize,
|
||||||
.free = free,
|
.free = free,
|
||||||
.remap = remap,
|
.remap = remap,
|
||||||
}
|
} };
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn alloc(
|
fn alloc(
|
||||||
|
|||||||
Reference in New Issue
Block a user