Function putMove [src]
Same as put but the key and value become owned by the BufMap rather
than being copied.
If putMove fails, the ownership of key and value does not transfer.
Prototype
pub fn putMove(self: *BufMap, key: []u8, value: []u8) !void Parameters
self: *BufMapkey: []u8value: []u8 Source
pub fn putMove(self: *BufMap, key: []u8, value: []u8) !void {
const get_or_put = try self.hash_map.getOrPut(key);
if (get_or_put.found_existing) {
self.free(get_or_put.key_ptr.*);
self.free(get_or_put.value_ptr.*);
get_or_put.key_ptr.* = key;
}
get_or_put.value_ptr.* = value;
}