SeekError,
}
-type ByteIOResult<T> = Result<T, ByteIOError>;
+pub type ByteIOResult<T> = Result<T, ByteIOError>;
pub trait ByteIO {
fn read_buf(&mut self, buf: &mut [u8]) -> ByteIOResult<usize>;
pub fn is_eof(&mut self) -> bool {
self.io.is_eof()
}
+
+ pub fn size(&mut self) -> i64 {
+ self.io.size()
+ }
+
+ pub fn left(&mut self) -> i64 {
+ let size = self.io.size();
+ if size == -1 { return -1; }
+ return size - (self.io.tell() as i64)
+ }
}
impl<'a> MemoryReader<'a> {