From 9efff08e1fe7efadf401ee09278b73bb42843a34 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Sun, 25 Aug 2024 20:36:17 +0200 Subject: [PATCH] refactor: use explicit error type to Button widget --- src/tui/Button.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tui/Button.zig b/src/tui/Button.zig index 92e596a..3d9efa3 100644 --- a/src/tui/Button.zig +++ b/src/tui/Button.zig @@ -46,7 +46,7 @@ pub fn Options(context: type) type { }; } -pub fn create(ctx_type: type, a: std.mem.Allocator, parent: Plane, opts: Options(ctx_type)) !*State(ctx_type) { +pub fn create(ctx_type: type, a: std.mem.Allocator, parent: Plane, opts: Options(ctx_type)) error{OutOfMemory}!*State(ctx_type) { const Self = State(ctx_type); const self = try a.create(Self); var n = try Plane.init(&opts.pos.opts(@typeName(Self)), parent); @@ -61,7 +61,7 @@ pub fn create(ctx_type: type, a: std.mem.Allocator, parent: Plane, opts: Options return self; } -pub fn create_widget(ctx_type: type, a: std.mem.Allocator, parent: Plane, opts: Options(ctx_type)) !Widget { +pub fn create_widget(ctx_type: type, a: std.mem.Allocator, parent: Plane, opts: Options(ctx_type)) error{OutOfMemory}!Widget { return Widget.to(try create(ctx_type, a, parent, opts)); }