Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

fieldIndex

Public Function
std.meta.fieldIndex
pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int

Given a type and a name, return the field index according to source order. Returns null if the field is not found.

Params

  • T: type
  • name: []const u8

File

meta.zig:729
729
730
731
732
733
734
735
pub fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int {
    inline for (fieldNames(T), 0..) |field_name, i| {
        if (mem.eql(u8, field_name, name))
            return i;
    }
    return null;
}