mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
WIP code for the basic methods on the Zig RocDict type (init, deinit, clone, allocate)
This commit is contained in:
parent
7a64ffede5
commit
7e63f72922
2 changed files with 99 additions and 8 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue