-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-UnicodeArea: UnicodeArea: UnicodeC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.
Description
The semantics of this should be tightened up (or probably even better new function(s) with better names should be added). Is the buffer supposed to be utf-8? 7-bit ASCII?
Also it should probably stop if it hits a NUL character. One place where this is annoying is inet_ntop which writes an ASCII representation of an address to a user provided buffer. With the way from_str works now you have to write silly code like:
alt vec::position(buffer, {|c| c == 0u8})
{
option::some(i)
{
str::from_bytes(vec::slice(buffer, 0u, i))
}
option::none
{
str::from_bytes(buffer)
}
}
Metadata
Metadata
Assignees
Labels
A-UnicodeArea: UnicodeArea: UnicodeC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.