Skip to content

Commit

Permalink
feat: Upgrade to Zig 0.14.0-dev
Browse files Browse the repository at this point in the history
Signed-off-by: Naoki Ikeguchi <[email protected]>
  • Loading branch information
siketyan committed Jan 2, 2025
1 parent 2d7c157 commit 6be1cb5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
version: master
- run: zig fmt --check *.zig src/*.zig

build:
Expand All @@ -31,7 +31,7 @@ jobs:
submodules: true
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
version: master

- name: Build examples
run: zig build run-example-basic
Expand Down
4 changes: 2 additions & 2 deletions src/Counter.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn dec(self: *Self) void {

pub fn add(self: *Self, value: anytype) void {
switch (@typeInfo(@TypeOf(value))) {
.Int, .Float, .ComptimeInt, .ComptimeFloat => {},
.int, .float, .comptime_int, .comptime_float => {},
else => @compileError("can't add a non-number"),
}

Expand All @@ -42,7 +42,7 @@ pub fn get(self: *const Self) u64 {

pub fn set(self: *Self, value: anytype) void {
switch (@typeInfo(@TypeOf(value))) {
.Int, .Float, .ComptimeInt, .ComptimeFloat => {},
.int, .float, .comptime_int, .comptime_float => {},
else => @compileError("can't set a non-number"),
}

Expand Down
10 changes: 5 additions & 5 deletions src/Gauge.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const Metric = @import("metric.zig").Metric;

pub fn GaugeCallFnType(comptime StateType: type, comptime Return: type) type {
const CallFnArgType = switch (@typeInfo(StateType)) {
.Pointer => StateType,
.Optional => |opt| opt.child,
.Void => void,
.pointer => StateType,
.optional => |opt| opt.child,
.void => void,
else => *StateType,
};

Expand Down Expand Up @@ -40,10 +40,10 @@ pub fn Gauge(comptime StateType: type, comptime Return: type) type {
pub fn get(self: *Self) Return {
const TypeInfo = @typeInfo(StateType);
switch (TypeInfo) {
.Pointer, .Void => {
.pointer, .void => {
return self.callFn(self.state);
},
.Optional => {
.optional => {
if (self.state) |state| {
return self.callFn(state);
}
Expand Down

0 comments on commit 6be1cb5

Please sign in to comment.