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. Private Function

rendersMultiline

Private Function
std.zig.Ast.Render.rendersMultiline
fn rendersMultiline(r: *const Render, node: Ast.Node.Index) error

Params

File

zig/Ast/Render.zig:966
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
fn rendersMultiline(r: *const Render, node: Ast.Node.Index) error{OutOfMemory}!bool {
    var no_nl_buf: [64]u8 = undefined;
    var no_nl_w: Writer = .{
        .vtable = &.{ .drain = drainNoNewline },
        .buffer = &no_nl_buf,
    };

    if (r.ais.disabled_offset != null) return true;
    var sub_ais: AutoIndentingStream = .init(r.gpa, &no_nl_w, r.ais.indent_delta);
    defer sub_ais.deinit();
    // The following are needed to make sure isLineOverIndented is correct
    sub_ais.indent_count = r.ais.indent_count;
    sub_ais.applied_indent = r.ais.applied_indent;
    sub_ais.current_line_empty = r.ais.current_line_empty;

    var sub_r: Render = .{
        .gpa = r.gpa,
        .ais = &sub_ais,
        .tree = r.tree,
        .fixups = r.fixups,
    };

    renderExpression(&sub_r, node, .none) catch |err| return switch (err) {
        error.OutOfMemory => |e| return e,
        error.WriteFailed => return true,
    };
    if (sub_ais.disabled_offset != null) return true;
    if (std.mem.findScalar(u8, no_nl_w.buffered(), '\n') != null) {
        return true;
    }

    return false;
}