|
|
@ -370,7 +370,7 @@ test Path { |
|
|
|
// In the above example, `absolute_parts` is an array allocated onto the |
|
|
|
// In the above example, `absolute_parts` is an array allocated onto the |
|
|
|
// stack, and as such will only be valid until the end of the scope. This |
|
|
|
// stack, and as such will only be valid until the end of the scope. This |
|
|
|
// means no allocation is necessary, but it also means `absolute1` is only |
|
|
|
// means no allocation is necessary, but it also means `absolute1` is only |
|
|
|
// valid for as long as its parts. |
|
|
|
// valid for as long as its parts are. |
|
|
|
// If a path instance is not immediately consumed and you're uncertain |
|
|
|
// If a path instance is not immediately consumed and you're uncertain |
|
|
|
// about the lifetime of its parts, consider using `.clone(alloc)`. |
|
|
|
// about the lifetime of its parts, consider using `.clone(alloc)`. |
|
|
|
|
|
|
|
|
|
|
@ -431,6 +431,6 @@ test Path { |
|
|
|
// A deep clone of a path can be allocated using `.clone()`. |
|
|
|
// A deep clone of a path can be allocated using `.clone()`. |
|
|
|
// This clone owns the outer array and its inner strings. |
|
|
|
// This clone owns the outer array and its inner strings. |
|
|
|
const twin = try another_relative.clone(alloc); |
|
|
|
const twin = try another_relative.clone(alloc); |
|
|
|
|
|
|
|
defer twin.deinit(); |
|
|
|
try expect.fmt("mom/sister/child", "{}", .{twin}); |
|
|
|
try expect.fmt("mom/sister/child", "{}", .{twin}); |
|
|
|
twin.deinit(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|