mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-08 12:54:28 +00:00
lib: add a TaggedUnion helper to create C ABI compatible tagged unions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const std = @import("std");
|
||||
const Target = @import("target.zig").Target;
|
||||
|
||||
/// Create an enum type with the given keys that is C ABI compatible
|
||||
/// if we're targeting C, otherwise a Zig enum with smallest possible
|
||||
@@ -58,11 +59,6 @@ pub fn Enum(
|
||||
return Result;
|
||||
}
|
||||
|
||||
pub const Target = union(enum) {
|
||||
c,
|
||||
zig,
|
||||
};
|
||||
|
||||
test "zig" {
|
||||
const testing = std.testing;
|
||||
const T = Enum(.zig, &.{ "a", "b", "c", "d" });
|
||||
|
||||
Reference in New Issue
Block a user