cloneWithAllocator
Creates a copy of this BufSet, using a specified allocator.
Function parameters
Parameters
- self:*const BufSet
A BufSet is a set of strings.
Types
- BufSet
- A BufSet is a set of strings.
Source
Implementation
pub fn cloneWithAllocator(
self: *const BufSet,
new_allocator: Allocator,
) Allocator.Error!BufSet {
const cloned_hashmap = try self.hash_map.cloneWithAllocator(new_allocator);
const cloned = BufSet{ .hash_map = cloned_hashmap };
var it = cloned.hash_map.keyIterator();
while (it.next()) |key_ptr| {
key_ptr.* = try cloned.copy(key_ptr.*);
}
return cloned;
}