[SR-9467] [String] Mutable conditional access to UTF8View #51929
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 70be96b99799b5808614625fa356ef61
Issue Description:
UTF8View has `withContiguousStorageIfAvailable`, but we would like to add `withContiguousMutableStorageIfAvailable`. The challenge here is that we must validate the contents post-mutation to preserve the validly-encoded UTF-8 contents invariant. However, a `nil` return value communicates that contiguous storage is not available, and even if this wasn't so, we wouldn't want to copy out the entire old contents just in case.
We could consider trapping if the user wrote invalid data in.
The text was updated successfully, but these errors were encountered: