Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions uuid.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ pub const UUID = struct {
return uuid;
}

fn to_string(self: UUID,slice: []u8) void {
var string:[36]u8 = format_uuid(self);
pub fn to_string(self: UUID, slice: []u8) void {
var string: [36]u8 = format_uuid(self);
std.mem.copy(u8, slice, &string);
}

fn format_uuid(self: UUID) [36]u8 {
pub fn format_uuid(self: UUID) [36]u8 {
var buf: [36]u8 = undefined;
buf[8] = '-';
buf[13] = '-';
Expand Down Expand Up @@ -161,8 +161,8 @@ test "check to_string works" {
uuid1.to_string(&string1);
uuid1.to_string(&string2);

std.debug.print("\nUUID {s} \n", .{uuid1});
std.debug.print("\nFirst call to_string {s} \n", .{string1});
std.debug.print("Second call to_string {s} \n", .{string2});
std.log.debug("\nUUID {s} \n", .{uuid1});
std.log.debug("\nFirst call to_string {s} \n", .{string1});
std.log.debug("Second call to_string {s} \n", .{string2});
try testing.expectEqual(string1, string2);
}