Function insert [src]

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

Prototype

pub fn insert(self: *BufSet, value: []const u8) !void

Parameters

self: *BufSetvalue: []const u8

Source

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; }; } }