diff options
Diffstat (limited to 'src/libstd/io/extensions.rs')
| -rw-r--r-- | src/libstd/io/extensions.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index 12caa715865..ffbcdd87bfe 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -37,10 +37,29 @@ use ptr::RawPtr; /// /// Any error other than `EndOfFile` that is produced by the underlying Reader /// is returned by the iterator and should be handled by the caller. +#[cfg(stage0)] pub struct Bytes<'r, T> { reader: &'r mut T, } +/// An iterator that reads a single byte on each iteration, +/// until `.read_byte()` returns `EndOfFile`. +/// +/// # Notes about the Iteration Protocol +/// +/// The `Bytes` may yield `None` and thus terminate +/// an iteration, but continue to yield elements if iteration +/// is attempted again. +/// +/// # Error +/// +/// Any error other than `EndOfFile` that is produced by the underlying Reader +/// is returned by the iterator and should be handled by the caller. +#[cfg(not(stage0))] +pub struct Bytes<'r, T:'r> { + reader: &'r mut T, +} + impl<'r, R: Reader> Bytes<'r, R> { /// Constructs a new byte iterator from the given Reader instance. pub fn new(r: &'r mut R) -> Bytes<'r, R> { |
