Type Function FieldType [src]

Deprecated: use @FieldType

Prototype

pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type

Parameters

T: typefield: FieldEnum(T)

Example

test FieldType { const S = struct { a: u8, b: u16, }; const U = union { c: u32, d: *const u8, }; try testing.expect(FieldType(S, .a) == u8); try testing.expect(FieldType(S, .b) == u16); try testing.expect(FieldType(U, .c) == u32); try testing.expect(FieldType(U, .d) == *const u8); }

Source

pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type { return @FieldType(T, @tagName(field)); }