Closed
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)
}
}