add(view): View type for composing view modules
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 22s

This commit is contained in:
2025-01-14 01:14:55 +01:00
parent 817056cf8b
commit 3048b59e84
4 changed files with 183 additions and 48 deletions

View File

@@ -12,6 +12,7 @@ pub const Error = struct {
};
// System events available to every application.
// TODO: should this also already include the .view enum option?
pub const SystemEvent = union(enum) {
quit,
err: Error,
@@ -21,6 +22,7 @@ pub const SystemEvent = union(enum) {
};
pub fn mergeTaggedUnions(comptime A: type, comptime B: type) type {
// TODO: should this expect one of the unions to contain the .view value option with its corresponding associated type?
if (!isTaggedUnion(A) or !isTaggedUnion(B)) {
@compileError("Both types for merging tagged unions need to be of type `union(enum)`.");
}