This repository was archived by the owner on Mar 19, 2026. It is now read-only.
Description I would like be able to return a pointer to an object via the Union.
Example with html/Window from https://github.com/lightpanda-io/browser , the following Union declaration:
const generate = @import ("../generate.zig" );
pub const Interfaces = generate .Tuple (.{
Window ,
});
const Generated = generate .Union .compile (Interfaces );
pub const Union = Generated ._union ;
pub const Tags = Generated ._enum ;
Adding this function doesn't compile.
pub fn get_window (self : * Window ) Union {
return .{ .Window = self };
}
$ zig build
install
└─ install lightpanda
└─ zig build-exe lightpanda Debug native 1 errors
src/html/window.zig:81:29: error: expected type 'html.window.Window', found '*html.window.Window'
return .{ .Window = self };
^~~~
src/html/window.zig:43:20: note: struct declared here
pub const Window = struct {
^~~~~~
referenced by:
callFunc__anon_29998: vendor/zig-js-runtime/src/engines/v8/generate.zig:916:22
getter: vendor/zig-js-runtime/src/engines/v8/generate.zig:1029:21
remaining reference traces hidden; use '-freference-trace' to see all reference traces
But this one works.
pub fn get_window (self : * Window ) Union {
return .{ .Window = self .* };
} Reactions are currently unavailable
I would like be able to return a pointer to an object via the
Union.Example with
html/Windowfrom https://github.com/lightpanda-io/browser, the followingUniondeclaration:Adding this function doesn't compile.
But this one works.