Function dupe [src]
Copies m to newly allocated memory. Caller owns the memory.
Prototype
pub fn dupe(allocator: Allocator, comptime T: type, m: []const T) Error![]T
Parameters
allocator: Allocator
T: type
m: []const T
Possible Errors
Source
pub fn dupe(allocator: Allocator, comptime T: type, m: []const T) Error![]T {
const new_buf = try allocator.alloc(T, m.len);
@memcpy(new_buf, m);
return new_buf;
}