Zig 0.17.0-dev (Split by item)
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 library itself.
Zig › std/ › heap/ › SafeAllocator.zig › formatStackTrace
formatStackTrace
SafeAllocator.formatStackTrace
fn formatStackTrace (trace_buf : []usize ) std .debug .FormatStackTrace
File
Code
fn formatStackTrace (trace_buf : []usize ) std .debug .FormatStackTrace {
return .{
.stack_trace = if (trace_buf .len != 0 ) trace : {
const frames = trace_buf [0 ];
const addrs = trace_buf [1 ..];
break :trace .{
.return_addresses = addrs [0 ..@min (frames , addrs .len )],
.skipped = switch (frames ) {
else => @fromBackingInt (@intCast (frames -| addrs .len )),
0 , math .maxInt (usize ) => .unknown ,
},
};
} else .{
.return_addresses = &.{},
.skipped = .unknown ,
},
.terminal_mode = std .log .terminalMode (),
};
}