libuv: fix self-dependent zig error

This commit is contained in:
Mitchell Hashimoto
2022-04-22 13:28:59 -07:00
parent 947596ea5e
commit 7d48135e58

View File

@ -9,10 +9,12 @@ const Loop = @import("Loop.zig");
pub fn Handle(comptime T: type) type { pub fn Handle(comptime T: type) type {
// 1. T should be a struct // 1. T should be a struct
// 2. First field should be the handle pointer // 2. First field should be the handle pointer
return struct {
// note: this has to be here: https://github.com/ziglang/zig/issues/11367
const tInfo = @typeInfo(T).Struct; const tInfo = @typeInfo(T).Struct;
const HandleType = tInfo.fields[0].field_type; const HandleType = tInfo.fields[0].field_type;
return struct {
// Request handle to be closed. close_cb will be called asynchronously // Request handle to be closed. close_cb will be called asynchronously
// after this call. This MUST be called on each handle before memory // after this call. This MUST be called on each handle before memory
// is released. Moreover, the memory can only be released in close_cb // is released. Moreover, the memory can only be released in close_cb