Open2

Zigの知らなかった機能

smallkirbysmallkirby

Destructuring assignment みたいなやつ

fn hoge() struct { u64, u64 } {
    return .{ 1, 2 };
}
const a, const b = hoge();
smallkirbysmallkirby

Error Union の OR

const SomeError = error{ ErrorOne, ErrorTwo };
const SomeType = struct {
    const Error = error{ErrorThree};
};
inline fn hoge(s: anytype) (SomeError || @TypeOf(s).Error || error{ErrorFive})!void {
    return;
}
try hoge(SomeType{});