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 › build-web/ › time_report.zig › genericResultMessage
genericResultMessage
time_report.genericResultMessage
pub fn genericResultMessage (msg_bytes : []u8 ) error
File
Code
pub fn genericResultMessage (msg_bytes : []u8 ) error {OutOfMemory }!void {
if (msg_bytes .len != @sizeOf (abi .GenericResult )) @panic ("malformed GenericResult message" );
const msg : *const abi .GenericResult = @ptrCast (msg_bytes );
if (msg .step_idx >= step_list .*.len ) @panic ("malformed GenericResult message" );
const inner_html = try std .fmt .allocPrint (gpa ,
\\<code slot="step-name">{[step_name]f}</code>
\\<span slot="stat-total-time">{[stat_total_time]f}</span>
, .{
.step_name = fmtEscapeHtml (step_list .*[msg .step_idx ].name ),
.stat_total_time = std .Io .Duration { .nanoseconds = msg .ns_total },
});
defer gpa .free (inner_html );
js .updateGeneric (msg .step_idx , inner_html .ptr , inner_html .len );
}