-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Now, it's quite obvious that UnsafeSlice is... unsafe, but to help the next surprised poor soul I suggest you add something like the following to the documentation of UnsafeSlice.to_str:
The returned string is frozen, which means that any slices, slices of slices, and even the result of
.dup,.clone,String.new(str)(of the whole string or any slices) will still reference the underlying memory. To make a true copy that won't keep a reference:String.new(capacity: str.bytesize).concat(str)To copy a slice:
IO::Buffer.for(str).get_string(ofs, len)
Metadata
Metadata
Assignees
Labels
No labels