Skip to content

Commit d6229fc

Browse files
Serban Iorgaalxiord
authored andcommitted
[GuestMemory] run the map_and_fold() example
run the map_and_fold() example as a test Signed-off-by: Serban Iorga <seriorga@amazon.com>
1 parent c6a623d commit d6229fc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/guest_memory.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,10 @@ pub trait GuestMemory {
282282
///
283283
/// ```
284284
/// # #[cfg(feature = "backend-mmap")]
285+
/// # use vm_memory::{GuestAddress, GuestMemory, GuestMemoryRegion, GuestMemoryMmap};
286+
///
287+
/// # #[cfg(feature = "backend-mmap")]
285288
/// # fn test_map_fold() -> Result<(), ()> {
286-
/// # use vm_memory::{GuestAddress, GuestMemory, GuestMemoryRegion, mmap::GuestMemoryMmap};
287289
/// let start_addr1 = GuestAddress(0x0);
288290
/// let start_addr2 = GuestAddress(0x400);
289291
/// let mem = GuestMemoryMmap::new(&vec![(start_addr1, 1024), (start_addr2, 2048)]).unwrap();
@@ -295,6 +297,9 @@ pub trait GuestMemory {
295297
/// println!("Total memory size = {} KB", total_size);
296298
/// Ok(())
297299
/// # }
300+
///
301+
/// # #[cfg(feature = "backend-mmap")]
302+
/// # test_map_fold();
298303
/// ```
299304
fn map_and_fold<F, G, T>(&self, init: T, mapf: F, foldf: G) -> T
300305
where

0 commit comments

Comments
 (0)