pub fn write(&mut self, mut src: &[u8], mut offset: usize) {
        let page_size = PAGE_SIZE;

        while !src.is_empty() {
            let page = PageIndex::new((offset / page_size) as u64);
            let offset_into_page = offset % page_size;
            let page_len = src.len().min(page_size - offset_into_page);

            let dirty_page = self
                .dirty_pages
                .entry(page)
                .or_insert(*self.page_map.get_page(page));
            dirty_page[offset_into_page..offset_into_page + page_len]
                .copy_from_slice(&src[0..page_len]);

            offset += page_len;
            src = &src[page_len..src.len()];
        }
    }
/// Overwrites the contents of this buffer at the specified offset with the
/// contents of the source buffer.
Overwrites the contents of this buffer at the specified offset with the
contents of the source buffer.
Overwrites the contents of this buffer at the specified offset with the contents of the source buffer .
pub fn write(&mut self, mut src: &[u8], mut offset: usize) {
        let page_size = PAGE_SIZE;
        while !src.is_empty() {
            let page = PageIndex::new((offset / page_size) as u64);
            let offset_into_page = offset % page_size;
            let page_len = src.len().min(page_size - offset_into_page);
            let dirty_page = self
                .dirty_pages
                .entry(page)
                .or_insert(*self.page_map.get_page(page));
            dirty_page[offset_into_page..offset_into_page + page_len]
                .copy_from_slice(&src[0..page_len]);
            offset += page_len;
            src = &src[page_len..src.len()];
        }
    }
pub fn write ( & mut self , mut src : & [ u8 ] , mut offset : usize ) { let page_size = PAGE_SIZE ; while ! src . is_empty ( ) { let page = PageIndex :: new ( ( offset / page_size ) as u64 ) ; let offset_into_page = offset % page_size ; let page_len = src . len ( ) . min ( page_size - offset_into_page ) ; let dirty_page = self . dirty_pages . entry ( page ) . or_insert ( * self . page_map . get_page ( page ) ) ; dirty_page [ offset_into_page .. offset_into_page + page_len ] . copy_from_slice ( & src [ 0 .. page_len ] ) ; offset += page_len ; src = & src [ page_len .. src . len ( ) ] ; } }
Overwrites the contents of this buffer at the specified offset with the
contents of the source buffer.
Overwrites the contents of this buffer at the specified offset with the contents of the source buffer .
&mut self
src
&[u8]
offset
usize
&mut self
src
&[u8]
offset
usize