WIP code for the basic methods on the Zig RocDict type (init, deinit, clone, allocate)

This commit is contained in:
Chadtech 2021-01-31 00:33:06 -05:00
parent 7a64ffede5
commit 7e63f72922
2 changed files with 99 additions and 8 deletions

View file

@ -40,8 +40,6 @@ pub const RocStr = extern struct {
// This clones the pointed-to bytes if they won't fit in a
// small string, and returns a (pointer, len) tuple which points to them.
pub fn init(allocator: *Allocator, bytes_ptr: [*]const u8, length: usize) RocStr {
const roc_str_size = @sizeOf(RocStr);
var result = RocStr.allocate(allocator, InPlace.Clone, length);
@memcpy(result.asU8ptr(), bytes_ptr, length);