pub fn read_at(&mut self, offset: u64, size: usize) -> Result<&[u8]> {
        match offset {
            o if o == self.size => Ok(&[]),
            o if o > self.size => {
                Err(io::Error::new(io::ErrorKind::UnexpectedEof, "read beyond end of image").into())
            }
            _ => {
                let off = (offset & OFFSET_MASK) as usize;
                let seq = pos2chunk(offset);
                if self.open_page.seq != seq {
                    self.open_page = self.read(seq)?;
                }
                Ok(&self.open_page[off..min(off + size, CHUNKSZ)])
            }
        }
    }
/// Seeks to offset and reads the specified amount of bytes. Note that this function may
/// return less than `size` bytes.
Seeks to offset and reads the specified amount of bytes. Note that this function may
return less than `size` bytes.
Seeks to offset and reads the specified amount of bytes . Note that this function may return less than ` size ` bytes .
pub fn read_at(&mut self, offset: u64, size: usize) -> Result<&[u8]> {
        match offset {
            o if o == self.size => Ok(&[]),
            o if o > self.size => {
                Err(io::Error::new(io::ErrorKind::UnexpectedEof, "read beyond end of image").into())
            }
            _ => {
                let off = (offset & OFFSET_MASK) as usize;
                let seq = pos2chunk(offset);
                if self.open_page.seq != seq {
                    self.open_page = self.read(seq)?;
                }
                Ok(&self.open_page[off..min(off + size, CHUNKSZ)])
            }
        }
    }
pub fn read_at ( & mut self , offset : u64 , size : usize ) -> Result < & [ u8 ] > { match offset { o if o == self . size => Ok ( & [ ] ) , o if o > self . size => { Err ( io :: Error :: new ( io :: ErrorKind :: UnexpectedEof , " " ) . into ( ) ) } _ => { let off = ( offset & OFFSET_MASK ) as usize ; let seq = pos2chunk ( offset ) ; if self . open_page . seq != seq { self . open_page = self . read ( seq ) ? ; } Ok ( & self . open_page [ off .. min ( off + size , CHUNKSZ ) ] ) } } }
Seeks to offset and reads the specified amount of bytes.
Seeks to offset and reads the specified amount of bytes .
&mut self
offset
u64
size
usize
&mut self
offset
u64
size
usize