1
1
// Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
- //! Module containing versions of the standard library's [`Read`] and [`Write`] traits compatible
4
- //! with volatile memory accesses.
3
+ //! Module containing versions of the standard library's [`Read`](std::io::Read) and
4
+ //! [`Write`](std::io::Write) traits compatible with volatile memory accesses.
5
5
6
6
use crate :: bitmap:: BitmapSlice ;
7
7
use crate :: volatile_memory:: copy_slice_impl:: { copy_from_volatile_slice, copy_to_volatile_slice} ;
8
8
use crate :: { VolatileMemoryError , VolatileSlice } ;
9
9
use std:: io:: { Cursor , ErrorKind , Stdout } ;
10
10
use std:: os:: fd:: AsRawFd ;
11
11
12
- /// A version of the standard library's [`Read`] trait that operates on volatile memory instead of
13
- /// slices
12
+ /// A version of the standard library's [`Read`](std::io::Read) trait that operates on volatile
13
+ /// memory instead of slices
14
14
///
15
15
/// This trait is needed as rust slices (`&[u8]` and `&mut [u8]`) cannot be used when operating on
16
16
/// guest memory [1].
@@ -20,7 +20,7 @@ pub trait ReadVolatile {
20
20
/// Tries to read some bytes into the given [`VolatileSlice`] buffer, returning how many bytes
21
21
/// were read.
22
22
///
23
- /// The behavior of implementations should be identical to [`Read::read`]
23
+ /// The behavior of implementations should be identical to [`Read::read`](std::io::Read::read)
24
24
fn read_volatile < B : BitmapSlice > (
25
25
& mut self ,
26
26
buf : & mut VolatileSlice < B > ,
@@ -29,7 +29,7 @@ pub trait ReadVolatile {
29
29
/// Tries to fill the given [`VolatileSlice`] buffer by reading from `self` returning an error
30
30
/// if insufficient bytes could be read.
31
31
///
32
- /// The default implementation is identical to that of [`Read::read_exact`]
32
+ /// The default implementation is identical to that of [`Read::read_exact`](std::io::Read::read_exact)
33
33
fn read_exact_volatile < B : BitmapSlice > (
34
34
& mut self ,
35
35
buf : & mut VolatileSlice < B > ,
@@ -58,8 +58,8 @@ pub trait ReadVolatile {
58
58
}
59
59
}
60
60
61
- /// A version of the standard library's [`Write`] trait that operates on volatile memory instead of
62
- /// slices
61
+ /// A version of the standard library's [`Write`](std::io::Write) trait that operates on volatile
62
+ /// memory instead of slices.
63
63
///
64
64
/// This trait is needed as rust slices (`&[u8]` and `&mut [u8]`) cannot be used when operating on
65
65
/// guest memory [1].
@@ -69,7 +69,7 @@ pub trait WriteVolatile {
69
69
/// Tries to write some bytes from the given [`VolatileSlice`] buffer, returning how many bytes
70
70
/// were written.
71
71
///
72
- /// The behavior of implementations should be identical to [`Write::write`]
72
+ /// The behavior of implementations should be identical to [`Write::write`](std::io::Write::write)
73
73
fn write_volatile < B : BitmapSlice > (
74
74
& mut self ,
75
75
buf : & VolatileSlice < B > ,
@@ -78,7 +78,7 @@ pub trait WriteVolatile {
78
78
/// Tries write the entire content of the given [`VolatileSlice`] buffer to `self` returning an
79
79
/// error if not all bytes could be written.
80
80
///
81
- /// The default implementation is identical to that of [`Write::write_all`]
81
+ /// The default implementation is identical to that of [`Write::write_all`](std::io::Write::write_all)
82
82
fn write_all_volatile < B : BitmapSlice > (
83
83
& mut self ,
84
84
buf : & VolatileSlice < B > ,
0 commit comments