Skip to documentation
SLOP

tiny.choir.ir.format

Reference tiny.choir ir format

Defined in ir.

API (2)

Actions

Public operations.

No direct callersNo direct callsirformat
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallsNo direct callstest sourcelib.choir.src.core.format.test_formatappendFmt appends and advances positi...test sourcelib.choir.src.core.format.test_formatappendFmt errors on small buffertest sourcelib.choir.src.core.interfaces.opstest: OperationRegistry stable pointe...test sourcelib.choir.src.core.interfaces.typestest: TypeRegistry stable pointersdialects.ArithDialect.VecShuffleOpcreateir.formatappendFmt
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.choir.src.core.format.test_formatintPayload errors on small buffertest sourcelib.choir.src.core.format.test_formatintPayload formats integersir.formatintPayload
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/choir/src/core/format.zig

zig
const std = @import("std");pub fn appendFmt(    buf: []u8,    pos: usize,    comptime fmt: []const u8,    args: anytype,) !usize {    const slice = try std.fmt.bufPrint(buf[pos..], fmt, args);    return pos + slice.len;}pub fn intPayload(buf: []u8, value: anytype) ![]const u8 {    return std.fmt.bufPrint(buf, "{d}", .{value});}test "format.appendFmt appends and advances position" {    const testing = std.testing;    var buf: [32]u8 = undefined;    var pos: usize = 0;    pos = try appendFmt(buf[0..], pos, "hello", .{});    pos = try appendFmt(buf[0..], pos, " {s} {d}", .{ "world", 42 });    try testing.expectEqualStrings("hello world 42", buf[0..pos]);}test "format.intPayload formats integers" {    const testing = std.testing;    var buf: [16]u8 = undefined;    const payload = try intPayload(buf[0..], 12345);    try testing.expectEqualStrings("12345", payload);}test "format.appendFmt errors on small buffer" {    const testing = std.testing;    var buf: [4]u8 = undefined;    try testing.expectError(error.NoSpaceLeft, appendFmt(buf[0..], 0, "hello", .{}));}test "format.intPayload errors on small buffer" {    const testing = std.testing;    var buf: [2]u8 = undefined;    try testing.expectError(error.NoSpaceLeft, intPayload(buf[0..], 123));}

Source: lib/choir/src/core/root.zig:32

zig
pub const format = @import("format.zig");

Also reachable as

backends.wasm.emission.module_encoding.common.ir.format.

Audit

Definitions3
Public names6
Members0
Version26.7.0
Revisiondaab053ee433