|
3 | 3 | // For the full copyright and license information, please view the LICENSE |
4 | 4 | // file that was distributed with this source code. |
5 | 5 |
|
6 | | -//! Thin zero-copy-related wrappers around functions from the `rustix` crate. |
| 6 | +//! Thin zero-copy-related wrappers around functions. |
7 | 7 |
|
8 | 8 | #[cfg(any(target_os = "linux", target_os = "android"))] |
9 | 9 | use rustix::pipe::{SpliceFlags, fcntl_setpipe_size}; |
@@ -39,7 +39,7 @@ pub fn pipe<const SIZE_REQUIRED: bool>(s: usize) -> std::io::Result<(PipeReader, |
39 | 39 | Ok(pair) |
40 | 40 | } |
41 | 41 |
|
42 | | -/// Less noisy wrapper around [`rustix::pipe::splice`]. |
| 42 | +/// Less noisy wrapper around splice syscall |
43 | 43 | /// |
44 | 44 | /// Up to `len` bytes are moved from `source` to `target`. Returns the number |
45 | 45 | /// of successfully moved bytes. |
@@ -245,14 +245,10 @@ pub fn dev_null() -> Option<File> { |
245 | 245 | .ok()?; |
246 | 246 | let stat = rustix::fs::fstat(&null).ok()?; |
247 | 247 | let dev = stat.st_rdev; |
248 | | - if (rustix::fs::major(dev), rustix::fs::minor(dev)) == (1, 3) { |
249 | | - Some(null) |
250 | | - } else { |
251 | | - None |
252 | | - } |
| 248 | + ((rustix::fs::major(dev), rustix::fs::minor(dev)) == (1, 3)).then_some(null) |
253 | 249 | } |
254 | 250 |
|
255 | | -// Less noisy wrapper around [`rustix::pipe::tee`] |
| 251 | +// Less noisy wrapper around tee syscall |
256 | 252 | #[inline] |
257 | 253 | #[cfg(any(target_os = "linux", target_os = "android"))] |
258 | 254 | pub fn tee(source: &impl AsFd, target: &impl AsFd, len: usize) -> rustix::io::Result<usize> { |
|
0 commit comments