diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-06 08:41:03 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-06 08:41:03 +0200 |
| commit | dccd1987b418e47b4b82eda3aeaed40be18d9e45 (patch) | |
| tree | cc7a48007a4fdda07c71c4cfd6f7359f48c17472 /src/z/Env/Future.zig | |
| parent | 64146d3d4277b34946ab9a294b11e41979d7ac74 (diff) | |
wasm: make future hold error
Diffstat (limited to 'src/z/Env/Future.zig')
| -rw-r--r-- | src/z/Env/Future.zig | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/z/Env/Future.zig b/src/z/Env/Future.zig deleted file mode 100644 index 1e28ac7..0000000 --- a/src/z/Env/Future.zig +++ /dev/null @@ -1,34 +0,0 @@ -const std = @import("std"); -const Env = @import("root.zig"); -const z = @import("../root.zig"); - -const Self = @This(); - -result: *Env.Value, - -pub fn await(self: *const Self, env: *Env, comptime kind: Env.Value.Kind) kind.asType() { - const result = self.awaitAny(env); - - if (kind != result.kind) { - std.log.err("unexpected {}, expected {}", .{result.kind, kind}); - @panic("type error"); - } - - return switch (kind) { - .uninit => @panic("uninitialized result"), - .string => result.value.string.ptr[0..result.value.string.len], - else => @field(result.value, @tagName(kind)), - }; -} - -pub fn awaitAny(self: *const Self, env: *Env) Env.Value { - defer env.pool.destroy(self.result); - - if (self.result.kind != .uninit) { - return self.result.*; - } - - env.flush(); - - return self.result.*; -} |