Type Function PollFiles [src]

Given an enum, returns a struct with fields of that enum, each field representing an I/O stream for polling.

Prototype

pub fn PollFiles(comptime StreamEnum: type) type

Parameters

StreamEnum: type

Source

pub fn PollFiles(comptime StreamEnum: type) type { const enum_fields = @typeInfo(StreamEnum).@"enum".fields; var struct_fields: [enum_fields.len]std.builtin.Type.StructField = undefined; for (&struct_fields, enum_fields) |*struct_field, enum_field| { struct_field.* = .{ .name = enum_field.name ++ "", .type = fs.File, .default_value_ptr = null, .is_comptime = false, .alignment = @alignOf(fs.File), }; } return @Type(.{ .@"struct" = .{ .layout = .auto, .fields = &struct_fields, .decls = &.{}, .is_tuple = false, } }); }