fn restore(
        file: Option<&File>,
        state: &GuestMemoryState,
        track_dirty_pages: bool,
    ) -> std::result::Result<Self, Error> {
        let mut regions = vec![];
        for region in state.regions.iter() {
            let f = match file {
                Some(f) => Some(FileOffset::new(
                    f.try_clone().map_err(Error::FileHandle)?,
                    region.offset,
                )),
                None => None,
            };

            regions.push((f, GuestAddress(region.base_address), region.size));
        }

        vm_memory::create_guest_memory(&regions, track_dirty_pages).map_err(Error::CreateMemory)
    }
/// Creates a GuestMemoryMmap backed by a `file` if present, otherwise backed
/// by anonymous memory. Memory layout and ranges are described in `state` param.
Creates a GuestMemoryMmap backed by a `file` if present, otherwise backed
by anonymous memory. Memory layout and ranges are described in `state` param.
Creates a GuestMemoryMmap backed by a ` file ` if present otherwise backed by anonymous memory . Memory layout and ranges are described in ` state ` param .
fn restore(
        file: Option<&File>,
        state: &GuestMemoryState,
        track_dirty_pages: bool,
    ) -> std::result::Result<Self, Error> {
        let mut regions = vec![];
        for region in state.regions.iter() {
            let f = match file {
                Some(f) => Some(FileOffset::new(
                    f.try_clone().map_err(Error::FileHandle)?,
                    region.offset,
                )),
                None => None,
            };
            regions.push((f, GuestAddress(region.base_address), region.size));
        }
        vm_memory::create_guest_memory(&regions, track_dirty_pages).map_err(Error::CreateMemory)
    }
fn restore ( file : Option < & File > , state : & GuestMemoryState , track_dirty_pages : bool , ) -> std :: result :: Result < Self , Error > { let mut regions = vec ! [ ] ; for region in state . regions . iter ( ) { let f = match file { Some ( f ) => Some ( FileOffset :: new ( f . try_clone ( ) . map_err ( Error :: FileHandle ) ? , region . offset , ) ) , None => None , } ; regions . push ( ( f , GuestAddress ( region . base_address ) , region . size ) ) ; } vm_memory :: create_guest_memory ( & regions , track_dirty_pages ) . map_err ( Error :: CreateMemory ) }
Creates a GuestMemoryMmap backed by a `file` if present, otherwise backed
by anonymous memory.
Creates a GuestMemoryMmap backed by a ` file ` if present otherwise backed by anonymous memory .
file
Option<&File>
state
&GuestMemoryState
track_dirty_pages
bool
file
Option<&File>
state
&GuestMemoryState
track_dirty_pages
bool