fetchPut
See HashMap.fetchPut
Additionally contains KV.used to indicate if the value was used before the fetch
Parameters
- self:*Self
- *Self
- allocator:Allocator
- Allocator
- key:K
- K
- value:V
- V
Source
Implementation
pub fn fetchPut(self: *Self, allocator: Allocator, key: K, value: V) Allocator.Error!?KV {
const kv = try self.map.fetchPut(allocator, key, .{ .inner = value }) orelse return null;
return .{ .key = kv.key, .value = kv.value.inner, .used = kv.value.used };
}