Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

printSentinel

Public Function
std.mem.printSentinel
pub fn printSentinel(
    buffer: []u8,
    comptime format: []const u8,
    args: anytype,
    comptime sentinel: u8,
) PrintError![:sentinel]u8

Like print but returned slice has the provided sentinel.

Params

  • buffer: []u8
  • format: []const u8
  • args
  • sentinel: u8

Errors

NoSpaceLeft

As much as possible was written to the buffer, but it was too small to fit all the printed bytes.

File

mem.zig:5226
5226
5227
5228
5229
5230
5231
5232
5233
5234
pub fn printSentinel(
    buffer: []u8,
    comptime format: []const u8,
    args: anytype,
    comptime sentinel: u8,
) PrintError![:sentinel]u8 {
    const result = try print(buffer, format ++ [1]u8{sentinel}, args);
    return result[0 .. result.len - 1 :sentinel];
}