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
fnremoveFromArrayAndUpdateIndex(self: *Self, entry_index: usize, ctx: ByIndexContext, header: *IndexHeader, comptimeI: type, indexes: []Index(I), comptimeremoval_type: RemovalType) void {
constlast_index = self.entries.len - 1; // overflow => remove from empty mapswitch (removal_type) {
.swap => {
if (last_index != entry_index) {
// Because of the swap remove, now we need to update the index that was// pointing to the last entry and is now pointing to this removed item slot.self.updateEntryIndex(header, last_index, entry_index, ctx, I, indexes);
}
// updateEntryIndex reads from the old entry index,// so it needs to run before removal.self.entries.swapRemove(entry_index);
},
.ordered => {
vari: usize = entry_index;
while (i < last_index) : (i += 1) {
// Because of the ordered remove, everything from the entry index onwards has// been shifted forward so we'll need to update the index entries.self.updateEntryIndex(header, i + 1, i, ctx, I, indexes);
}
// updateEntryIndex reads from the old entry index,// so it needs to run before removal.self.entries.orderedRemove(entry_index);
},
}
}