Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ioslice docs to use shared slices #98330

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,8 +1240,8 @@ impl<'a> IoSlice<'a> {
/// use std::io::IoSlice;
/// use std::ops::Deref;
///
/// let mut data = [1; 8];
/// let mut buf = IoSlice::new(&mut data);
/// let data = [1; 8];
/// let mut buf = IoSlice::new(&data);
///
/// // Mark 3 bytes as read.
/// buf.advance(3);
Expand Down Expand Up @@ -1435,10 +1435,10 @@ pub trait Write {
/// use std::fs::File;
///
/// fn main() -> std::io::Result<()> {
/// let mut data1 = [1; 8];
/// let mut data2 = [15; 8];
/// let io_slice1 = IoSlice::new(&mut data1);
/// let io_slice2 = IoSlice::new(&mut data2);
/// let data1 = [1; 8];
/// let data2 = [15; 8];
/// let io_slice1 = IoSlice::new(&data1);
/// let io_slice2 = IoSlice::new(&data2);
///
/// let mut buffer = File::create("foo.txt")?;
///
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/os/unix/net/ancillary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ impl<'a> SocketAncillary<'a> {
/// let mut ancillary = SocketAncillary::new(&mut ancillary_buffer[..]);
/// ancillary.add_fds(&[sock.as_raw_fd()][..]);
///
/// let mut buf = [1; 8];
/// let mut bufs = &mut [IoSlice::new(&mut buf[..])][..];
/// let buf = [1; 8];
/// let mut bufs = &mut [IoSlice::new(&buf[..])][..];
/// sock.send_vectored_with_ancillary(bufs, &mut ancillary)?;
/// Ok(())
/// }
Expand Down