Function clone [src]
Creates a copy of this BufSet, using the same allocator.
Prototype
pub fn clone(self: *const BufSet) Allocator.Error!BufSet
Parameters
self: *const BufSet
Example
test clone {
var original = BufSet.init(testing.allocator);
defer original.deinit();
try original.insert("x");
var cloned = try original.clone();
defer cloned.deinit();
cloned.remove("x");
try testing.expect(original.count() == 1);
try testing.expect(cloned.count() == 0);
try testing.expectError(
error.OutOfMemory,
original.cloneWithAllocator(testing.failing_allocator),
);
}
Source
pub fn clone(self: *const BufSet) Allocator.Error!BufSet {
return self.cloneWithAllocator(self.allocator());
}