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.

namespace_members

main.namespace_members
export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index)

File

lib/docs/wasm/main.zig:923

Code

export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index) {
    const g = struct {
        var members: ArrayList(Decl.Index) = .empty;
    };

    g.members.clearRetainingCapacity();

    for (Walk.decls.items, 0..) |*decl, i| {
        if (decl.parent == parent) {
            if (include_private or decl.is_pub()) {
                g.members.append(gpa, @fromBackingInt(@intCast(i))) catch @panic("OOM");
            }
        }
    }

    return Slice(Decl.Index).init(g.members.items);
}