TUI editor and editor backend written in Zig
1const std = @import("std");
2
3const Formatter = @This();
4
5vtable: *const VTable,
6
7pub const VTable = struct {
8 format: *const fn (f: *Formatter, gpa: std.mem.Allocator, input: []const u8) anyerror![]const u8 = format,
9};
10
11/// Runs a formatter on the provided input, and returns the formatted output. Caller owns the
12/// returned memory.
13pub fn format(f: *Formatter, gpa: std.mem.Allocator, input: []const u8) anyerror![]const u8 {
14 return try f.vtable.format(f, gpa, input);
15}