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 › Build › Configuration › Wip › addStringList Public Function addStringList Doc Source Public Function std.Build.Configuration.Wip.addStringList
pub fn addStringList (wip : *Wip , list : []const []const u8 ) Allocator .Error !StringList Params wip : *Wip list : []const []const u8 File Build/Configuration.zig: 209
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228 pub fn addStringList (wip : *Wip , list : []const []const u8 ) Allocator .Error !StringList {
// Increase size of extra to support the list. Add the string list
// there. Then check for duplicate, reverting list if already found.
const gpa = wip .gpa ;
const revert_index : u32 = @intCast (wip .extra .items .len );
const added = try wip .extra .addManyAsSlice (gpa , list .len + 1 );
added [0 ] = @intCast (list .len );
for (added [1 ..], list ) |*d , s | d .* = @backingInt (try addString (wip , s ));
const gop = try wip .dedupe_table .getOrPutContext (gpa , .{
.index = revert_index ,
.len = @intCast (added .len ),
}, @as (ExtraSlice .Context , .{ .extra = wip .extra .items }));
if (gop .found_existing ) {
wip .extra .items .len = revert_index ;
return @fromBackingInt (@intCast (gop .key_ptr .index ));
}
return @fromBackingInt (@intCast (revert_index ));
}