/// Reads the contents of this buffer at the specified offset into the
/// specified destination buffer.
Reads the contents of this buffer at the specified offset into the
specified destination buffer.
Reads the contents of this buffer at the specified offset into the specified destination buffer .
pub fn read(&self, mut dst: &mut [u8], mut offset: usize) {
        let page_size = PAGE_SIZE;
        while !dst.is_empty() {
            let page = PageIndex::new((offset / page_size) as u64);
            let offset_into_page = offset % page_size;
            let page_len = dst.len().min(page_size - offset_into_page);
            let page_contents = match self.dirty_pages.get(&page) {
                Some(bytes) => bytes,
                None => self.page_map.get_page(page),
            };
            dst[0..page_len]
                .copy_from_slice(&page_contents[offset_into_page..offset_into_page + page_len]);
            offset += page_len;
            let n = dst.len();
            dst = &mut dst[page_len..n];
        }
    }
pub fn read ( & self , mut dst : & mut [ u8 ] , mut offset : usize ) { let page_size = PAGE_SIZE ; while ! dst . is_empty ( ) { let page = PageIndex :: new ( ( offset / page_size ) as u64 ) ; let offset_into_page = offset % page_size ; let page_len = dst . len ( ) . min ( page_size - offset_into_page ) ; let page_contents = match self . dirty_pages . get ( & page ) { Some ( bytes ) => bytes , None => self . page_map . get_page ( page ) , } ; dst [ 0 .. page_len ] . copy_from_slice ( & page_contents [ offset_into_page .. offset_into_page + page_len ] ) ; offset += page_len ; let n = dst . len ( ) ; dst = & mut dst [ page_len .. n ] ; } }
Reads the contents of this buffer at the specified offset into the
specified destination buffer.
Reads the contents of this buffer at the specified offset into the specified destination buffer .
&self
dst
&mut [u8]
offset
usize