Skip to content

Commit

Permalink
add a method to show the FileProducer's state
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Nov 7, 2015
1 parent 1ca2b7a commit c21a8f5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ impl<'x,'b> Producer<'b,&'x[u8],Move> for MemProducer<'x> {
}
}

#[derive(Debug,Clone,PartialEq,Eq)]
enum FileProducerState {
#[derive(Debug,Copy,Clone,PartialEq,Eq)]
pub enum FileProducerState {
Normal,
Error,
Eof
Expand Down Expand Up @@ -240,6 +240,10 @@ impl FileProducer {
})
}

pub fn state(&self) -> FileProducerState {
self.state
}

// FIXME: should handle refill until a certain size is obtained
pub fn refill(&mut self) -> Option<usize> {
shift(&mut self.v, self.start, self.end);
Expand Down

0 comments on commit c21a8f5

Please sign in to comment.