DVUI

getOrPut

See HashMap.getOrPut

Parameters

#
self:*Self
*Self
allocator:Allocator
Allocator
key:K
K

Source

Implementation

#
pub fn getOrPut(self: *Self, allocator: Allocator, key: K) Allocator.Error!GetOrPutResult {
            const entry = try self.map.getOrPut(allocator, key);
            if (tracking != .put_only) entry.value_ptr.used = true;
            return .{
                .key_ptr = entry.key_ptr,
                .value_ptr = &entry.value_ptr.inner,
                .found_existing = entry.found_existing,
            };
        }