diff options
author | 2022-09-23 03:21:38 -0700 | |
---|---|---|
committer | 2022-09-23 03:21:38 -0700 | |
commit | 5b222996c8e7a69bd2e99ef26f1f26ae3e3f9471 (patch) | |
tree | 08b8016c4014300f2dfbfee22e6f9c001e84b7e0 | |
parent | 62e22b29959cc984cf9abfa42c30a5b2925841fd (diff) | |
download | bun-5b222996c8e7a69bd2e99ef26f1f26ae3e3f9471.tar.gz bun-5b222996c8e7a69bd2e99ef26f1f26ae3e3f9471.tar.zst bun-5b222996c8e7a69bd2e99ef26f1f26ae3e3f9471.zip |
Update bindings.zig
-rw-r--r-- | src/bun.js/bindings/bindings.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 45f95a617..f737c783e 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -188,6 +188,15 @@ pub const ZigString = extern struct { len: u32, allocated: bool = false, + pub fn fromUTF8(input: []const u8) Slice { + return .{ + .ptr = input.ptr, + .len = @truncate(u32, input.len), + .allocated = false, + .allocator = bun.default_allocator, + }; + } + pub const empty = Slice{ .allocator = bun.default_allocator, .ptr = undefined, .len = 0, .allocated = false }; pub fn clone(this: Slice, allocator: std.mem.Allocator) !Slice { |