Add navigate telemetry

This commit is contained in:
Karl Seguin
2025-03-03 19:49:24 +08:00
parent 2609671982
commit 6b83281539
11 changed files with 59 additions and 44 deletions

View File

@@ -7,18 +7,30 @@ const Telemetry = @import("telemetry/telemetry.zig").Telemetry;
// Container for global state / objects that various parts of the system
// might need.
pub const App = struct {
loop: *Loop,
allocator: Allocator,
telemetry: Telemetry,
pub fn init(allocator: Allocator, loop: *Loop) !App {
pub fn init(allocator: Allocator) !App {
const loop = try allocator.create(Loop);
errdefer allocator.destroy(loop);
loop.* = try Loop.init(allocator);
errdefer loop.deinit();
const telemetry = Telemetry.init(allocator, loop);
errdefer telemetry.deinit();
return .{
.loop = loop,
.allocator = allocator,
.telemetry = telemetry,
};
}
pub fn deinit(self: *App) void {
self.telemetry.deinit();
self.loop.deinit();
self.allocator.destroy(self.loop);
}
};