hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 7174b76ad5b7213341bb561020f250b4cf6eb517
parent 4ea0cc4608d44db7bf52b187bf744b71a1f6fc94
Author: Sebastian <sebastian@sebsite.pw>
Date:   Thu, 21 Apr 2022 15:48:02 -0400

path: add ownership info to "string" docs

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mpath/buffer.ha | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/path/buffer.ha b/path/buffer.ha @@ -49,6 +49,9 @@ export fn set(buf: *buffer, items: str...) (str | errors::overflow) = { // // path::set(&buf, "foo", "bar", "/")!; // assert(path::string(&buf) == "foo/bar/"); +// +// The return value is borrowed from the buffer. Use [[allocate]] to extend the +// lifetime of the string. export fn string(buf: *buffer) str = { const value = strings::fromutf8_unsafe(buf.buf[..buf.end]); if (value == "") {