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 standard library.
std › zig › AstGen › typeCast Private Function typeCast Doc Source Private Function std.zig.AstGen.typeCast
fn typeCast (
gz : *GenZir ,
scope : *Scope ,
ri : ResultInfo ,
node : Ast .Node .Index ,
operand_node : Ast .Node .Index ,
tag : Zir .Inst .Tag ,
builtin_name : []const u8 ,
) InnerError !Zir .Inst .Ref Params Errors File zig/AstGen.zig: 9728
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747 fn typeCast (
gz : *GenZir ,
scope : *Scope ,
ri : ResultInfo ,
node : Ast .Node .Index ,
operand_node : Ast .Node .Index ,
tag : Zir .Inst .Tag ,
builtin_name : []const u8 ,
) InnerError !Zir .Inst .Ref {
const cursor = maybeAdvanceSourceCursorToMainToken (gz , node );
const result_type = try ri .rl .resultTypeForCast (gz , node , builtin_name );
const operand = try expr (gz , scope , .{ .rl = .none }, operand_node );
try emitDbgStmt (gz , cursor );
const result = try gz .addPlNode (tag , node , Zir .Inst .Bin {
.lhs = result_type ,
.rhs = operand ,
});
return rvalue (gz , ri , result , node );
}