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

insert

Public Function
std.buf_set.BufSet.insert
pub fn insert(self: *BufSet, value: []const u8) !void

Insert an item into the BufSet. The item will be copied, so the caller may delete or reuse the passed string immediately.

Params

  • self: *BufSet
  • value: []const u8

File

buf_set.zig:36
36
37
38
39
40
41
42
43
44
    pub fn insert(self: *BufSet, value: []const u8) !void {
        const gop = try self.hash_map.getOrPut(value);
        if (!gop.found_existing) {
            gop.key_ptr.* = self.copy(value) catch |err| {
                _ = self.hash_map.remove(value);
                return err;
            };
        }
    }