Zig 0.17.0-dev (Split by item)
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 library itself.
Zig › docs/ › wasm/ › main.zig › ast_decl_fields_fallible
ast_decl_fields_fallible
main.ast_decl_fields_fallible
fn ast_decl_fields_fallible (ast : *Ast , ast_index : Ast .Node .Index ) ![]Ast .Node .Index
File
Code
fn ast_decl_fields_fallible (ast : *Ast , ast_index : Ast .Node .Index ) ![]Ast .Node .Index {
const g = struct {
var result : ArrayList (Ast .Node .Index ) = .empty ;
};
g .result .clearRetainingCapacity ();
var buf : [2 ]Ast .Node .Index = undefined ;
const container_decl = ast .fullContainerDecl (&buf , ast_index ) orelse return &.{};
for (container_decl .ast .members ) |member_node | switch (ast .nodeTag (member_node )) {
.container_field_init ,
.container_field_align ,
.container_field ,
=> try g .result .append (gpa , member_node ),
else => continue ,
};
return g .result .items ;
}