Skip to content

Commit 1a6cf3b

Browse files
bonzinijiangliu
authored andcommitted
volatile_memory: documentation fixes
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent fbae1a4 commit 1a6cf3b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/volatile_memory.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ impl Bytes<usize> for VolatileSlice<'_> {
467467
type E = Error;
468468

469469
/// # Examples
470-
/// * Write a slice at offset 256.
470+
/// * Write a slice of size 5 at offset 1020 of a 1024-byte VolatileSlice.
471471
///
472472
/// ```
473473
/// # use vm_memory::{Bytes, VolatileMemory};
@@ -492,7 +492,7 @@ impl Bytes<usize> for VolatileSlice<'_> {
492492
}
493493

494494
/// # Examples
495-
/// * Read a slice of size 16 at offset 256.
495+
/// * Read a slice of size 16 at offset 1010 of a 1024-byte VolatileSlice.
496496
///
497497
/// ```
498498
/// # use vm_memory::{Bytes, VolatileMemory};
@@ -526,8 +526,8 @@ impl Bytes<usize> for VolatileSlice<'_> {
526526
/// # let mut mem_ref = &mut mem[..];
527527
/// # let vslice = mem_ref.as_volatile_slice();
528528
/// let res = vslice.write_slice(&[1,2,3,4,5], 256);
529-
/// assert!(res.is_ok());
530-
/// assert_eq!(res.unwrap(), ());
529+
/// # assert!(res.is_ok());
530+
/// # assert_eq!(res.unwrap(), ());
531531
/// ```
532532
fn write_slice(&self, buf: &[u8], addr: usize) -> Result<()> {
533533
let len = self.write(buf, addr)?;
@@ -550,8 +550,8 @@ impl Bytes<usize> for VolatileSlice<'_> {
550550
/// # let vslice = mem_ref.as_volatile_slice();
551551
/// let buf = &mut [0u8; 16];
552552
/// let res = vslice.read_slice(buf, 256);
553-
/// assert!(res.is_ok());
554-
/// assert_eq!(res.unwrap(), ());
553+
/// # assert!(res.is_ok());
554+
/// # assert_eq!(res.unwrap(), ());
555555
/// ```
556556
fn read_slice(&self, buf: &mut [u8], addr: usize) -> Result<()> {
557557
let len = self.read(buf, addr)?;

0 commit comments

Comments
 (0)