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 › zon › Serializer › typeIsRecursiveInner Private Function typeIsRecursiveInner Doc Source Private Function std.zon.Serializer.typeIsRecursiveInner
fn typeIsRecursiveInner (comptime T : type , comptime prev_visited : []const type ) bool Params T : type prev_visited : []const type File zon/Serializer.zig: 814
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833 fn typeIsRecursiveInner (comptime T : type , comptime prev_visited : []const type ) bool {
for (prev_visited ) |V | {
if (V == T ) return true ;
}
const visited = prev_visited ++ .{T };
return switch (@typeInfo (T )) {
.pointer => |pointer | typeIsRecursiveInner (pointer .child , visited ),
.optional => |optional | typeIsRecursiveInner (optional .child , visited ),
.array => |array | typeIsRecursiveInner (array .child , visited ),
.vector => |vector | typeIsRecursiveInner (vector .child , visited ),
.@"struct" => |@"struct" | for (@"struct" .field_types ) |field_type | {
if (typeIsRecursiveInner (field_type , visited )) break true ;
} else false ,
.@"union" => |@"union" | inline for (@"union" .field_types ) |field_type | {
if (typeIsRecursiveInner (field_type , visited )) break true ;
} else false ,
else => false ,
};
}