Fix doc test failures on Windows.
This commit is contained in:
parent
e555003e6d
commit
b4dfa198bf
3 changed files with 7 additions and 1 deletions
|
@ -159,6 +159,7 @@ pub trait AsFd {
|
||||||
/// # use std::os::unix::io::{AsFd, BorrowedFd};
|
/// # use std::os::unix::io::{AsFd, BorrowedFd};
|
||||||
///
|
///
|
||||||
/// let mut f = File::open("foo.txt")?;
|
/// let mut f = File::open("foo.txt")?;
|
||||||
|
/// # #[cfg(any(unix, target_os = "wasi"))]
|
||||||
/// let borrowed_fd: BorrowedFd<'_> = f.as_fd();
|
/// let borrowed_fd: BorrowedFd<'_> = f.as_fd();
|
||||||
/// # Ok::<(), io::Error>(())
|
/// # Ok::<(), io::Error>(())
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
@ -40,6 +40,7 @@ pub trait AsRawFd {
|
||||||
///
|
///
|
||||||
/// let mut f = File::open("foo.txt")?;
|
/// let mut f = File::open("foo.txt")?;
|
||||||
/// // Note that `raw_fd` is only valid as long as `f` exists.
|
/// // Note that `raw_fd` is only valid as long as `f` exists.
|
||||||
|
/// #[cfg(any(unix, target_os = "wasi"))]
|
||||||
/// let raw_fd: RawFd = f.as_raw_fd();
|
/// let raw_fd: RawFd = f.as_raw_fd();
|
||||||
/// # Ok::<(), io::Error>(())
|
/// # Ok::<(), io::Error>(())
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -75,9 +76,11 @@ pub trait FromRawFd {
|
||||||
/// use std::os::wasi::io::{FromRawFd, IntoRawFd, RawFd};
|
/// use std::os::wasi::io::{FromRawFd, IntoRawFd, RawFd};
|
||||||
///
|
///
|
||||||
/// let f = File::open("foo.txt")?;
|
/// let f = File::open("foo.txt")?;
|
||||||
|
/// # #[cfg(any(unix, target_os = "wasi"))]
|
||||||
/// let raw_fd: RawFd = f.into_raw_fd();
|
/// let raw_fd: RawFd = f.into_raw_fd();
|
||||||
/// // SAFETY: no other functions should call `from_raw_fd`, so there
|
/// // SAFETY: no other functions should call `from_raw_fd`, so there
|
||||||
/// // is only one owner for the file descriptor.
|
/// // is only one owner for the file descriptor.
|
||||||
|
/// # #[cfg(any(unix, target_os = "wasi"))]
|
||||||
/// let f = unsafe { File::from_raw_fd(raw_fd) };
|
/// let f = unsafe { File::from_raw_fd(raw_fd) };
|
||||||
/// # Ok::<(), io::Error>(())
|
/// # Ok::<(), io::Error>(())
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -106,6 +109,7 @@ pub trait IntoRawFd {
|
||||||
/// use std::os::wasi::io::{IntoRawFd, RawFd};
|
/// use std::os::wasi::io::{IntoRawFd, RawFd};
|
||||||
///
|
///
|
||||||
/// let f = File::open("foo.txt")?;
|
/// let f = File::open("foo.txt")?;
|
||||||
|
/// #[cfg(any(unix, target_os = "wasi"))]
|
||||||
/// let raw_fd: RawFd = f.into_raw_fd();
|
/// let raw_fd: RawFd = f.into_raw_fd();
|
||||||
/// # Ok::<(), io::Error>(())
|
/// # Ok::<(), io::Error>(())
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
@ -237,9 +237,10 @@ pub trait AsHandle {
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust,no_run
|
/// ```rust,no_run
|
||||||
|
/// # #![feature(io_safety)]
|
||||||
/// use std::fs::File;
|
/// use std::fs::File;
|
||||||
/// # use std::io;
|
/// # use std::io;
|
||||||
/// use std::os::windows::{AsHandle, BorrowedHandle};
|
/// use std::os::windows::io::{AsHandle, BorrowedHandle};
|
||||||
///
|
///
|
||||||
/// let mut f = File::open("foo.txt")?;
|
/// let mut f = File::open("foo.txt")?;
|
||||||
/// let borrowed_handle: BorrowedHandle<'_> = f.as_handle();
|
/// let borrowed_handle: BorrowedHandle<'_> = f.as_handle();
|
||||||
|
|
Loading…
Add table
Reference in a new issue