Skip to content

Commit f56ca47

Browse files
RuoqingHeroypat
authored andcommitted
doc: Add comment to helper functions marked as pub
Add comment on helper function `new` of `MmapRegion` and `raw_os_error` of `Error`. Signed-off-by: Ruoqing He <[email protected]>
1 parent 018cb08 commit f56ca47

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/mmap_unix.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,10 @@ mod tests {
455455

456456
type MmapRegion = super::MmapRegion<()>;
457457

458-
// Adding a helper method to extract the errno within an Error::Mmap(e), or return a
459-
// distinctive value when the error is represented by another variant.
460458
impl Error {
459+
/// Helper method to extract the errno within an
460+
/// `Error::Mmap(e)`. Returns `i32::MIN` if `self` is any
461+
/// other variant.
461462
pub fn raw_os_error(&self) -> i32 {
462463
match self {
463464
Error::Mmap(e) => e.raw_os_error().unwrap(),

src/mmap_xen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ mod tests {
10631063
}
10641064

10651065
impl MmapRegion {
1066+
/// Create an `MmapRegion` with specified `size` at GuestAdress(0)
10661067
pub fn new(size: usize) -> Result<Self> {
10671068
let range = MmapRange::new_unix(size, None, GuestAddress(0));
10681069
Self::from_range(range)

0 commit comments

Comments
 (0)