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.

Tree

ast.Tree
pub const Tree = struct

File

Code

pub const Tree = struct {
    node: *Node,
    input_code_pages: CodePageLookup,
    output_code_pages: CodePageLookup,

    /// not owned by the tree
    source: []const u8,

    arena: std.heap.ArenaAllocator.State,
    allocator: Allocator,

    pub fn deinit(self: *Tree) void {
        self.arena.promote(self.allocator).deinit();
    }

    pub fn root(self: *Tree) *Node.Root {
        return @alignCast(@fieldParentPtr("base", self.node));
    }

    pub fn dump(self: *Tree, writer: *std.Io.Writer) !void {
        try self.node.dump(self, writer, 0);
    }
}