about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2014-03-24 23:22:23 -0700
committerKevin Ballard <kevin@sb.org>2014-05-13 18:45:20 -0700
commit972f2e585528515eaab4bee7270acda7f7375398 (patch)
tree6a0f342014cfd7f5dc03c469dd754c19d7e81e78 /src/rustllvm/RustWrapper.cpp
parentcb115ac2d4f57d8b590c8d46d8f9e2958ed9a527 (diff)
downloadrust-972f2e585528515eaab4bee7270acda7f7375398.tar.gz
rust-972f2e585528515eaab4bee7270acda7f7375398.zip
io: Add .read_at_least() to Reader
Reader.read_at_least() ensures that at least a given number of bytes
have been read. The most common use-case for this is ensuring at least 1
byte has been read. If the reader returns 0 enough times in a row, a new
error kind NoProgress will be returned instead of looping infinitely.

This change is necessary in order to properly support Readers that
repeatedly return 0, either because they're broken, or because they're
attempting to do a non-blocking read on some resource that never becomes
available.

Also add .push() and .push_at_least() methods. push() is like read() but
the results are appended to the passed Vec.

Remove Reader.fill() and Reader.push_exact() as they end up being thin
wrappers around read_at_least() and push_at_least().

[breaking-change]
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions