|
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. |
| 6 | +//! Zero-copy-related functions. |
7 | 7 |
|
8 | 8 | #[cfg(any(target_os = "linux", target_os = "android"))] |
9 | 9 | use crate::io::{RawReader, RawWriter}; |
@@ -46,10 +46,8 @@ pub fn pipe<const SIZE_REQUIRED: bool>(s: usize) -> std::io::Result<(PipeReader, |
46 | 46 | /// Up to `len` bytes are moved from `source` to `target`. Returns the number |
47 | 47 | /// of successfully moved bytes. |
48 | 48 | /// |
49 | | -/// At least one of `source` and `target` must be some sort of pipe. |
50 | | -/// To get around this requirement, consider splicing from your source into |
51 | | -/// a [`pipe`] and then from the pipe into your target (with `splice_exact`): |
52 | | -/// this is still very efficient. |
| 49 | +/// splice fails if both of `source` and `target` are not pipe. Consider using |
| 50 | +/// splice_unbounded_broker or splice_unbounded_auto in the case. |
53 | 51 | #[inline] |
54 | 52 | #[cfg(any(target_os = "linux", target_os = "android"))] |
55 | 53 | pub fn splice(source: &impl AsFd, target: &impl AsFd, len: usize) -> rustix::io::Result<usize> { |
@@ -102,8 +100,8 @@ pub fn splice_unbounded(source: &impl AsFd, dest: &mut impl AsFd) -> rustix::io: |
102 | 100 |
|
103 | 101 | /// force-splice source to dest even both of them are not pipe via broker pipe |
104 | 102 | /// returns Ok(Ok(())) if splice succeeds |
105 | | -/// returns Ok(Err()) if splice failed, but you can fallback to read/write |
106 | | -/// returns std::io::Result if splice from broker failed and read/write fallback from broker failed |
| 103 | +/// returns Ok(Err(())) if splice failed, but you can fallback to read/write |
| 104 | +/// returns Err(e) if splice from broker failed and read/write fallback from broker failed |
107 | 105 | /// |
108 | 106 | /// Thus, ?.is_err() returns serious error at early stage and checks that you can fallback |
109 | 107 | /// This should not be used if one of them are pipe to save resources |
@@ -163,7 +161,7 @@ pub fn splice_unbounded_auto(source: &impl AsFd, dest: &mut impl AsFd) -> std::i |
163 | 161 | Ok(fallback) |
164 | 162 | } |
165 | 163 |
|
166 | | -/// splice `n` bytes with safe read/write fallback |
| 164 | +/// splice `n` bytes with read/write fallback |
167 | 165 | /// return actually sent bytes |
168 | 166 | #[inline] |
169 | 167 | #[cfg(any(target_os = "linux", target_os = "android"))] |
|
0 commit comments