wstdout - A library for writing wide character strings to standard output in Zig.
Usage:
Calling its interface via getStdOut():
const wstdout = @import("wstdout");
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
var w = try wstdout.Writer.init(allocator, 1024);
defer w.deinit();
const stdout = w.getStdOut();
try stdout.print("test library\n", .{});
try stdout.flush();
// Output:
// test library
}Install:
zig fetch --save https://github.com/deeper-x/wstdout/archive/refs/heads/main.zipSetup build.zig:
const wstdout = b.dependency("wstdout", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("wstdout", wstdout.module("wstdout"));Test:
zig build test --summary all
Build Summary: 5/5 steps succeeded; 1/1 tests passed
test success
├─ run test 1 passed 270us MaxRSS:2M
│ └─ compile test Debug native success 367ms MaxRSS:120M
└─ run test success 197us MaxRSS:2M
└─ compile test Debug native success 387ms MaxRSS:120M