diff options
| author | David Mo <david@dmo.ooo> | 2025-02-25 10:15:58 -0500 |
|---|---|---|
| committer | David Mo <david@dmo.ooo> | 2025-02-25 10:15:58 -0500 |
| commit | af2d710000cbe42068f419356f3d2f1511a3326b (patch) | |
| tree | 83ce713137f5b8f09ff71c1713a2a62abc775888 /src/cli | |
| parent | 22d99f2533571f1a4c4bf0535ba5c7fcaa387e9e (diff) | |
rename `setToDefault` to `init`
Diffstat (limited to 'src/cli')
| -rw-r--r-- | src/cli/args.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cli/args.zig b/src/cli/args.zig index 420a014dc..bf927a414 100644 --- a/src/cli/args.zig +++ b/src/cli/args.zig @@ -262,8 +262,8 @@ pub fn parseIntoField( if (value) |v| default: { if (v.len != 0) break :default; // Set default value if possible. - if (canHaveDecls and @hasDecl(Field, "setToDefault")) { - try @field(dst, field.name).setToDefault(alloc); + if (canHaveDecls and @hasDecl(Field, "init")) { + try @field(dst, field.name).init(alloc); return; } const raw = field.default_value orelse break :default; @@ -767,7 +767,7 @@ test "parseIntoField: ignore underscore-prefixed fields" { try testing.expectEqualStrings("12", data._a); } -test "parseIntoField: struct with default func" { +test "parseIntoField: struct with init func" { const testing = std.testing; var arena = ArenaAllocator.init(testing.allocator); defer arena.deinit(); @@ -779,7 +779,7 @@ test "parseIntoField: struct with default func" { v: []const u8, - pub fn setToDefault(self: *Self, _alloc: Allocator) !void { + pub fn init(self: *Self, _alloc: Allocator) !void { _ = _alloc; self.v = "HELLO!"; } |
