Function render [src]

gpa is used for allocating the resulting formatted source code. Caller owns the returned slice of bytes, allocated with gpa.

Prototype

pub fn render(tree: Ast, gpa: Allocator) RenderError![]u8

Parameters

tree: Astgpa: Allocator

Possible Errors

OutOfMemory

Ran out of memory allocating call stack frames to complete rendering, or ran out of memory allocating space in the output buffer.

Source

pub fn render(tree: Ast, gpa: Allocator) RenderError![]u8 { var buffer = std.ArrayList(u8).init(gpa); defer buffer.deinit(); try tree.renderToArrayList(&buffer, .{}); return buffer.toOwnedSlice(); }