fix: correct zig bindings for timeout

This commit is contained in:
CJ van den Berg 2024-02-26 18:08:18 +01:00
parent aa30a93d46
commit 9fe4bc0c1f

View file

@ -611,7 +611,7 @@ pub const metronome = struct {
}; };
pub const timeout = struct { pub const timeout = struct {
handle: *c.struct_thespian_timeout_handle, handle: ?*c.struct_thespian_timeout_handle,
const Self = @This(); const Self = @This();
@ -623,16 +623,13 @@ pub const timeout = struct {
return .{ .handle = c.thespian_timeout_create_ms(tick_time_us, m.to(c.cbor_buffer)) orelse return error.ThespianTimeoutInitFailed }; return .{ .handle = c.thespian_timeout_create_ms(tick_time_us, m.to(c.cbor_buffer)) orelse return error.ThespianTimeoutInitFailed };
} }
pub fn start(self: *const Self) !void { pub fn cancel(self: *const Self) !void {
return neg_to_error(c.thespian_timeout_start(self.handle), error.ThespianTimeoutStartFailed); return neg_to_error(c.thespian_timeout_cancel(self.handle), error.ThespianTimeoutCancelFailed);
} }
pub fn stop(self: *const Self) !void { pub fn deinit(self: *Self) void {
return neg_to_error(c.thespian_timeout_stop(self.handle), error.ThespianTimeoutStopFailed);
}
pub fn deinit(self: *const Self) void {
c.thespian_timeout_destroy(self.handle); c.thespian_timeout_destroy(self.handle);
self.handle = null;
} }
}; };