1
Fork 0

std::io: New ErrorKind value InvalidData

This takes the cases from InvalidInput where a data format error
was encountered. This is different from the documented semantics
of InvalidInput, which more likely indicate a programming error.
This commit is contained in:
Mikhail Zabaluev 2015-05-09 18:57:26 +03:00
parent 2d447e40e2
commit 1d67cef6d2
3 changed files with 9 additions and 2 deletions

View file

@ -80,7 +80,7 @@ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
let ret = f(g.s);
if str::from_utf8(&g.s[g.len..]).is_err() {
ret.and_then(|_| {
Err(Error::new(ErrorKind::InvalidInput,
Err(Error::new(ErrorKind::InvalidData,
"stream did not contain valid UTF-8"))
})
} else {