Skip to content

Commit f3f061a

Browse files
committed
Add minimal documentation comments for io_slice.rs.
This file is derived from Rust upstream, so don't add extensive comments, but do add links to where more documentation can be found.
1 parent 7354f7d commit f3f061a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/imp/linux_raw/io/io_slice.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use super::c;
88
use core::marker::PhantomData;
99
use core::slice;
1010

11+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html>
1112
#[derive(Copy, Clone)]
1213
#[repr(transparent)]
1314
pub struct IoSlice<'a> {
@@ -16,6 +17,7 @@ pub struct IoSlice<'a> {
1617
}
1718

1819
impl<'a> IoSlice<'a> {
20+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html#method.new>
1921
#[inline]
2022
pub fn new(buf: &'a [u8]) -> IoSlice<'a> {
2123
IoSlice {
@@ -27,6 +29,7 @@ impl<'a> IoSlice<'a> {
2729
}
2830
}
2931

32+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html#method.advance>
3033
#[inline]
3134
pub fn advance(&mut self, n: usize) {
3235
if self.vec.iov_len < n as u64 {
@@ -39,19 +42,22 @@ impl<'a> IoSlice<'a> {
3942
}
4043
}
4144

45+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html#method.as_slice>
4246
#[inline]
4347
pub fn as_slice(&self) -> &[u8] {
4448
unsafe { slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len as usize) }
4549
}
4650
}
4751

52+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html>
4853
#[repr(transparent)]
4954
pub struct IoSliceMut<'a> {
5055
vec: c::iovec,
5156
_p: PhantomData<&'a mut [u8]>,
5257
}
5358

5459
impl<'a> IoSliceMut<'a> {
60+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html#method.new>
5561
#[inline]
5662
pub fn new(buf: &'a mut [u8]) -> IoSliceMut<'a> {
5763
IoSliceMut {
@@ -63,6 +69,7 @@ impl<'a> IoSliceMut<'a> {
6369
}
6470
}
6571

72+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html#method.advance>
6673
#[inline]
6774
pub fn advance(&mut self, n: usize) {
6875
if self.vec.iov_len < n as u64 {
@@ -75,11 +82,13 @@ impl<'a> IoSliceMut<'a> {
7582
}
7683
}
7784

85+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html#method.as_slice>
7886
#[inline]
7987
pub fn as_slice(&self) -> &[u8] {
8088
unsafe { slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len as usize) }
8189
}
8290

91+
/// <https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html#method.as_slice_mut>
8392
#[inline]
8493
pub fn as_mut_slice(&mut self) -> &mut [u8] {
8594
unsafe {

0 commit comments

Comments
 (0)