@@ -30,14 +30,13 @@ pub trait AsRawFd {
30
30
///
31
31
/// ```no_run
32
32
/// use std::fs::File;
33
+ /// # use std::io;
33
34
/// use std::os::unix::io::{AsRawFd, RawFd};
34
35
///
35
- /// fn main() -> std::io::Result<()> {
36
- /// let mut f = File::open("foo.txt")?;
37
- /// // Note that `raw_fd` is only valid as long as `f` exists.
38
- /// let raw_fd: RawFd = f.as_raw_fd();
39
- /// Ok(())
40
- /// }
36
+ /// let mut f = File::open("foo.txt")?;
37
+ /// // Note that `raw_fd` is only valid as long as `f` exists.
38
+ /// let raw_fd: RawFd = f.as_raw_fd();
39
+ /// # Ok::<(), io::Error>(())
41
40
/// ```
42
41
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
43
42
fn as_raw_fd ( & self ) -> RawFd ;
@@ -64,16 +63,15 @@ pub trait FromRawFd {
64
63
///
65
64
/// ```no_run
66
65
/// use std::fs::File;
66
+ /// # use std::io;
67
67
/// use std::os::unix::io::{FromRawFd, IntoRawFd, RawFd};
68
68
///
69
- /// fn main() -> std::io::Result<()> {
70
- /// let f = File::open("foo.txt")?;
71
- /// let raw_fd: RawFd = f.into_raw_fd();
72
- /// // SAFETY: no other functions should call `from_raw_fd`, so there
73
- /// // is only one owner for the file descriptor.
74
- /// let f = unsafe { File::from_raw_fd(raw_fd) };
75
- /// Ok(())
76
- /// }
69
+ /// let f = File::open("foo.txt")?;
70
+ /// let raw_fd: RawFd = f.into_raw_fd();
71
+ /// // SAFETY: no other functions should call `from_raw_fd`, so there
72
+ /// // is only one owner for the file descriptor.
73
+ /// let f = unsafe { File::from_raw_fd(raw_fd) };
74
+ /// # Ok::<(), io::Error>(())
77
75
/// ```
78
76
#[ stable( feature = "from_raw_os" , since = "1.1.0" ) ]
79
77
unsafe fn from_raw_fd ( fd : RawFd ) -> Self ;
@@ -93,13 +91,12 @@ pub trait IntoRawFd {
93
91
///
94
92
/// ```no_run
95
93
/// use std::fs::File;
94
+ /// # use std::io;
96
95
/// use std::os::unix::io::{IntoRawFd, RawFd};
97
96
///
98
- /// fn main() -> std::io::Result<()> {
99
- /// let f = File::open("foo.txt")?;
100
- /// let raw_fd: RawFd = f.into_raw_fd();
101
- /// Ok(())
102
- /// }
97
+ /// let f = File::open("foo.txt")?;
98
+ /// let raw_fd: RawFd = f.into_raw_fd();
99
+ /// # Ok::<(), io::Error>(())
103
100
/// ```
104
101
#[ stable( feature = "into_raw_os" , since = "1.4.0" ) ]
105
102
fn into_raw_fd ( self ) -> RawFd ;
0 commit comments