pub fn renderAlloc(tree: Ast, gpa: Allocator) error
gpa is used for allocating the resulting formatted source code. Caller owns the returned slice of bytes, allocated with gpa.
gpa
tree: Ast
gpa: Allocator
220 221 222 223 224 225 226 227
pub fn renderAlloc(tree: Ast, gpa: Allocator) error{OutOfMemory}![]u8 { var aw: std.Io.Writer.Allocating = .init(gpa); defer aw.deinit(); render(tree, gpa, &aw.writer, .{}) catch |err| switch (err) { error.WriteFailed, error.OutOfMemory => return error.OutOfMemory, }; return aw.toOwnedSlice(); }
gpais used for allocating the resulting formatted source code. Caller owns the returned slice of bytes, allocated withgpa.