Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Public Function

metadataString

Public Function
std.zig.llvm.Builder.metadataString
pub fn metadataString(self: *Builder, bytes: []const u8) Allocator.Error!Metadata.String

Params

File

zig/llvm/Builder.zig:13283
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
pub fn metadataString(self: *Builder, bytes: []const u8) Allocator.Error!Metadata.String {
    assert(bytes.len > 0);
    try self.metadata_string_bytes.ensureUnusedCapacity(self.gpa, bytes.len);
    try self.metadata_string_indices.ensureUnusedCapacity(self.gpa, 1);
    try self.metadata_string_map.ensureUnusedCapacity(self.gpa, 1);

    const gop = self.metadata_string_map.getOrPutAssumeCapacityAdapted(
        bytes,
        Metadata.String.Adapter{ .builder = self },
    );
    if (!gop.found_existing) {
        self.metadata_string_bytes.appendSliceAssumeCapacity(bytes);
        self.metadata_string_indices.appendAssumeCapacity(
            @intCast(self.metadata_string_bytes.items.len),
        );
    }
    return @fromBackingInt(@intCast(gop.index));
}