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: AllocatorT: typem: []const T

Possible Errors

OutOfMemory

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; }