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.

SwitchNonErr

AstGen.SwitchNonErr
const SwitchNonErr = union(enum)

File

lib/std/zig/AstGen.zig:6974

Code

const SwitchNonErr = union(enum) {
    /// A regular switch expression.
    /// Emits `switch_block[_ref]`.
    none,
    /// `eu catch |err| switch (err) { ... }`
    ///
    /// `switch` must not be labeled.
    /// Emits `switch_block_err_union`.
    @"catch",
    /// `if (eu) |payload| { ... } else |err| switch (err) { ... }`
    ///
    /// `switch` must not be labeled.
    /// Emits `switch_block_err_union`.
    @"if": Ast.full.If,
    /// `eu catch |err| label: switch (err) { ... }`
    /// `if (eu) |payload| { ... } else |err| label: switch (err) { ... }`
    ///
    /// `switch` must be labeled.
    /// Emits a `condbr` on the non-error body and a regular switch, though the
    /// non-error prong and all `break`s from switch prongs are peers.
    /// Exists to avoid a rather complex special case of `switch_block_err_union`.
    peer_break_target: struct {
        /// Refers to the enclosing block of the entire switch-on-err expression.
        block_inst: Zir.Inst.Index,
        /// Belongs to `block_inst`.
        block_ri: ResultInfo,
    },
}