1
Fork 0

De-~[] Reader and Writer

There's a little more allocation here and there now since
from_utf8_owned can't be used with Vec.
This commit is contained in:
Steven Fackler 2014-03-26 09:24:16 -07:00
parent 94a055c729
commit d0e60b72ee
27 changed files with 117 additions and 108 deletions

View file

@ -1282,8 +1282,8 @@ pub fn from_reader(rdr: &mut io::Reader) -> DecodeResult<Json> {
Ok(c) => c,
Err(e) => return Err(IoError(e))
};
let s = match str::from_utf8_owned(contents) {
Some(s) => s,
let s = match str::from_utf8(contents.as_slice()) {
Some(s) => s.to_owned(),
None => return Err(ParseError(~"contents not utf-8", 0, 0))
};
let mut parser = Parser::new(s.chars());