Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade to Zig 0.14.0-dev #15

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading