Function cloneWithAllocator [src]
Creates a copy of this BufSet, using a specified allocator.
Prototype
pub fn cloneWithAllocator( self: *const BufSet, new_allocator: Allocator, ) Allocator.Error!BufSet
Parameters
self: *const BufSet
new_allocator: Allocator
Source
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;
}