Update bindings.zig

This commit is contained in:
Jarred Sumner
2022-02-14 20:20:38 -08:00
parent e5a71462b8
commit 8ec958ec01

View File

@@ -217,6 +217,9 @@ pub const ZigString = extern struct {
}
pub fn toSlice(this: ZigString, allocator: std.mem.Allocator) Slice {
if (this.len == 0)
return Slice{ .ptr = "", .len = 0, .allocator = allocator, .allocated = false };
if (is16Bit(&this)) {
var buffer = std.fmt.allocPrint(allocator, "{}", .{this}) catch unreachable;
return Slice{