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
fngetSlotByIndex(self: *Self, entry_index: usize, ctx: ByIndexContext, header: *IndexHeader, comptimeI: type, indexes: []Index(I)) usize {
constslice = self.entries.slice();
consth = if (store_hash) slice.items(.hash)[entry_index] elsecheckedHash(ctx, slice.items(.key)[entry_index]);
conststart_index = safeTruncate(usize, h);
constend_index = start_index +% indexes.len;
varindex = start_index;
vardistance_from_start_index: I = 0;
while (index != end_index) : ({
index +%= 1;
distance_from_start_index += 1;
}) {
constslot = header.constrainIndex(index);
constslot_data = indexes[slot];
// This is the fundamental property of the array hash map index. If this// assert fails, it probably means that the entry was not in the index.assert(!slot_data.isEmpty());
assert(slot_data.distance_from_start_index >= distance_from_start_index);
if (slot_data.entry_index == entry_index) {
returnslot;
}
}
unreachable;
}