mozilla/rust — pull request #1670 by killerswan (2012-01-26 07:34:54+00:00)
Title: str::from_bytes progress

This makes each of str::from_bytes, str::from_byte, and str::from_cstr either return str, or fail when the bytes given are not UTF-8. This does have a small performance cost, but is a step towards avoiding a sort of shotgun parser...

Although I have not yet stopped exporting str::unsafe_from_bytes or str::unsafe_from_byte, I have replaced their uses elsewhere in the source. In doing so, I changed encoder::encode_metadata to return a [u8] (instead of a str with non UTF-8 data).